我通过 Homebrew 安装了 Python 3.8 和 3.9:
~ brew list | grep python
python@3.8
python@3.9
我想使用 Python 3.9 作为我的默认版本 python3
命令。我尝试了以下方法:~ brew switch python 3.9
Error: python does not have a version "3.9" in the Cellar.
python's installed versions: 3.8.6
我试图卸载 Python 并重新安装它,但它被其他软件包使用:~ brew uninstall python
Error: Refusing to uninstall /usr/local/Cellar/python@3.8/3.8.6
because it is required by glib and php, which are currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies python
如何使用 Python 3.9?
最佳答案
有一个与 side by side install of Python 3.8 / 3.9 相关的 Homebrew 已知问题.要解决此问题,以下命令应该适合您:
brew unlink python@3.9
brew unlink python@3.8
brew link --force python@3.9
重新打开终端或执行命令 rehash
可能需要考虑更改。
关于python - 切换 Homebrew 安装的 Python 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64362772/