mac os 使用 brew 安装指定版本的 python 解释器
文章目录
各个版本:
- 3.10 👉
brew install python@3.10 - 3.9 👉
brew install python@3.9 - 3.8 👉
brew install python@3.8
M1 的 mac 最低是 3.8 了,3.7 没有提供
使用如下命令安装:
brew install python@3.8安装好之后会有如下的输出:
Python has been installed as
/opt/homebrew/opt/python@3.8/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/opt/homebrew/opt/python@3.8/libexec/bin
You can install Python packages with
/opt/homebrew/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
/opt/homebrew/lib/python3.8/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
python@3.8 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
If you need to have python@3.8 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/python@3.8/bin:$PATH"' >> ~/.zshrc
For compilers to find python@3.8 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/python@3.8/lib"
啥意思呢?就是告诉你不要忘了添加环境变量
关于 LDFLAGS 请参考 :https://www.cnblogs.com/taski...
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论