mac os 使用 brew 安装指定版本的 python 解释器


brew install python@3.8


Python has been installed as

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into

You can install Python packages with
  /opt/homebrew/opt/python@3.8/bin/pip3 install 
They will install into the site-package directory


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 请参考 :