一、本地安装python
打开终端
eg:安装版本号为3.11的python
brew install python@3.11
报错:Error: You have not agreed to the Xcode license. Please resolve this by running:
sudo xcodebuild -license accept
翻译:错误:您尚未同意Xcode许可证。请运行以下命令解决此问题:sudo xcodebuild-许可证接受
解决办法:在终端输入
sudo xcodebuild -license accept(回车键)
brew update(回车键)
brew install python@3.11(回车键)
安装成功!
二、验证是否安装成功
1️⃣查看python的版本
python --version
2️⃣查看python的安装地址
which python