Python3.8.1已经安装,但它仍然表示版本为2.7.17。我如何实际使用3.8.1?
$ brew install python@3.8
Warning: python@3.8 3.8.1 is already installed and up-to-date
To reinstall 3.8.1, run `brew reinstall python@3.8`
$ python --version
Python 2.7.17
发布于 2020-02-18 09:28:20
在python3
下安装Python3;它从不将python
命名为Python3,除非您明确地问它:https://docs.brew.sh/Homebrew-and-Python#python-3x-or-python-2x。
Python2和Python3都可以在没有冲突的情况下安装
:可执行文件的组织如下:
python3
指向Homebrew的Python3.x(如果installed)python2
指向Homebrew的Python2.7.x(如果installed)python
指向Homebrew的Python2.7.x(如果已安装),则为macOS系统Python )。如果您希望在PATH中添加Homebrew的3.xpython,请查看brew info python
。在brew info python
的输出之后,通过在$PATH
中添加以下路径,您应该能够获得指向Python3的不版本别名。
$(brew --prefix python@3.8)/libexec/bin
也就是说,在您的~/.bash_profile
或~/.bashrc
中添加以下行
PATH="$(brew --prefix python@3.8)/libexec/bin:$PATH"
启动一个新的shell,python
应该是Python3.8。
https://stackoverflow.com/questions/60271139
复制相似问题