MacBook m1 python安装
时间: 2023-09-13 09:11:50 浏览: 218
对于MacBook M1芯片的设备,您可以使用以下步骤来安装Python:
首先,打开终端应用程序。您可以在"应用程序"文件夹中找到它,或者使用Spotlight搜索。
在终端中输入以下命令,安装Homebrew(一个流行的包管理器):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
安装Xcode命令行工具。在终端中运行以下命令:
xcode-select --install
使用Homebrew安装pyenv。在终端中运行以下命令:
brew install pyenv
配置pyenv。在终端中运行以下命令:
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc # 如果您使用的是Zsh echo 'eval "$(pyenv init --path)"' >> ~/.bash_profile # 如果您使用的是Bash source ~/.zshrc # 或者 source ~/.bash_profile,根据您的shell选择合适的命令
安装Python。在终端中运行以下命令来查看可用的Python版本:
pyenv install --list
选择您想要安装的Python版本,并运行以下命令进行安装。例如,如果您想要安装Python 3.9.5版本:
pyenv install 3.9.5
设置全局Python版本。在终端中运行以下命令:
pyenv global 3.9.5
验证Python安装是否成功。在终端中运行以下命令:
python --version
如果成功安装了Python,您应该看到所安装的Python版本号。
现在,您已经成功在MacBook M1上安装了Python。希望这个步骤可以帮助到您!
相关推荐


















