MacOS stil points to python3.6



我可以确认我安装了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 的解决方法是什么?

非常确定这里的简单解决方法,因为您的路径很小,因此可以摆脱

在 PATH 变量中/anaconda3/bin/Users/Sani/anaconda3/bin

试试这个:

export PATH=$(p=$(echo $PATH | tr ":" "n" | grep -v "/anaconda3/bin" | tr "n" ":"); echo ${p%:})我们正在获取 grep 命令中的任何内容并将其删除

export PATH=$(p=$(echo $PATH | tr ":" "n" | grep -v "/Users/sani/anaconda3/bin" | tr "n" ":"); echo ${p%:})

您可能需要重新启动终端以查看它是否已更改。我假设 Python3.6 是通过 Anaconda 垃圾箱拾取的。

否则,是的,卸载 Anaconda3 将解决您的问题。

我找到了出路

conda install python=3.8

为我工作。

$ python
Python 3.8.3 (default, Jul  2 2020, 11:26:31) 
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

最新更新