【发布时间】:2019-01-23 21:45:17
【问题描述】:
我在链接 python3 并将 python3 设置为默认 python 时遇到问题。
MacOS 10.13.6
这就是我所做的:
$ python --version
Python 2.7.15
$ python3 --version
Python 3.7.0
$ xcode-select --version
xcode-select version 2349.
$ brew install python
...
Python has been installed as
/usr/local/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin
...
它不起作用。 python 仍然是 2.*
$ python --version
Python 2.7.15
$ python3 --version
Python 3.7.0
$ pip --version
pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
$ pip3 --version
pip 18.0 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
所以我做到了:
$ brew link python3
Warning: Already linked: /usr/local/Cellar/python/3.7.0
To relink: brew unlink python && brew link python
$ python --version
Python 2.7.15
$ brew install python3
...
Warning: python 3.7.0 is already installed and up-to-date
To reinstall 3.7.0, run `brew reinstall python`
$ brew reinstall python
也不行
$ brew link python3
Warning: Already linked: /usr/local/Cellar/python/3.7.0
To relink: brew unlink python && brew link python
$ python --version
Python 2.7.15
$ python3 --version
Python 3.7.0
【问题讨论】:
标签: python-3.x macos python-2.7