【发布时间】:2020-12-01 11:20:03
【问题描述】:
我可以确认我安装了 python3.8
brew install python
Warning: python@3.8 3.8.5 is already installed and up-to-date
To reinstall 3.8.5, run `brew reinstall python@3.8
不过,macOS 还是指向 python3.6
$python --version
Python 3.6.8 :: Anaconda, Inc.
$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
指向版本 3.8 的解决方法是什么?
【问题讨论】:
-
/usr/local/bin在您的PATH中的哪个位置(如果有)? -
$ echo $PATH /usr/local/bin:/anaconda3/bin:/Users/Sani/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin -
要么你需要运行
rehash来告诉shell在/usr/local/bin中再次寻找python的版本,或者你需要使用python3来访问新安装的Python 3 . -
先在
/anaconda3/bin目录下找到Python3.6,再在Homebrew安装Python3.8的目录下找到python。