有没有办法将Python 3.8.3设置为macOS Catalina上的默认Python版本-版本10.15.2?
我已完成的步骤:
ls -l /usr/local/bin/python*
我得到的输出是这样的:
lrwxr-xr-x 1 jeena admin 36 Mar 20 2019 /usr/local/bin/python -> ../Cellar/python@2/2.7.16/bin/python
lrwxr-xr-x 1 jeena admin 39 May 20 12:43 /usr/local/bin/python-build -> ../Cellar/pyenv/1.2.18/bin/python-build
lrwxr-xr-x 1 jeena admin 43 Mar 20 2019 /usr/local/bin/python-config -> ../Cellar/python@2/2.7.16/bin/python-config
lrwxr-xr-x 1 jeena admin 37 Mar 20 2019 /usr/local/bin/python2 -> ../Cellar/python@2/2.7.16/bin/python2
lrwxr-xr-x 1 jeena admin 44 Mar 20 2019 /usr/local/bin/python2-config -> ../Cellar/python@2/2.7.16/bin/python2-config
lrwxr-xr-x 1 jeena admin 39 Mar 20 2019 /usr/local/bin/python2.7 -> ../Cellar/python@2/2.7.16/bin/python2.7
lrwxr-xr-x 1 jeena admin 46 Mar 20 2019 /usr/local/bin/python2.7-config -> ../Cellar/python@2/2.7.16/bin/python2.7-config
lrwxr-xr-x 1 root wheel 69 May 20 12:22 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3
lrwxr-xr-x 1 root wheel 76 May 20 12:22 /usr/local/bin/python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3-config
lrwxr-xr-x 1 root wheel 71 May 20 12:22 /usr/local/bin/python3.8 -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x 1 root wheel 78 May 20 12:22 /usr/local/bin/python3.8-config -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
lrwxr-xr-x 1 jeena admin 37 Mar 20 2019 /usr/local/bin/pythonw -> ../Cellar/python@2/2.7.16/bin/pythonw
lrwxr-xr-x 1 jeena admin 38 Mar 20 2019 /usr/local/bin/pythonw2 -> ../Cellar/python@2/2.7.16/bin/pythonw2
lrwxr-xr-x 1 jeena admin 40 Mar 20 2019 /usr/local/bin/pythonw2.7 -> ../Cellar/python@2/2.7.16/bin/pythonw2.7
ln -s -f /usr/local/bin/python3.8 /usr/local/bin/python2.7
然后我再次检查了版本:
python --version
我的意思是-> Python 2.7.16
我也尝试过alias python="/usr/bin/python3.8"
,但可悲的是,它仍然是Python 2.7.16
答案 0 :(得分:3)
我认为您可以运行以下命令:
rm /usr/local/bin/python
ln -s /usr/local/bin/python3.8 /usr/local/bin/python
在您的〜/ .zshrc或〜/ .bashrc中,放入
export PATH=/usr/local/bin:$PATH
然后启动一个新的终端进行测试
echo $PATH
确保/ usr / local / bin在/ usr / bin之前