如何将默认的python3设置为python3.7? [英] How to set the default python3 to python3.7?
问题描述
在Macbook上,我在/usr/local/bin/Python3中有一个Python 3.6.8,在/usr/local/bin/Python3.7中有一个Python 3.7.6(另外,Mac默认是Python2,我不想更改它).
I have a Python 3.6.8 in /usr/local/bin/Python3 and a Python 3.7.6 in /usr/local/bin/Python3.7 on my Macbook (In addition, there is Mac default Python2, which I don't want to change it).
通过检查which python3
或python3 --version
,我可以看到当前的默认版本是Python 3.6.8.我想将默认的Python3设置为Python 3.7.6.我该怎么办?
By check which python3
or python3 --version
, I can see the current default version is Python 3.6.8. I'd like to set the default Python3 to Python 3.7.6. How can I do that?
推荐答案
您可以使用"ln"命令创建指向现有文件的符号链接(symlink),如下所示:
You can use the "ln" command to create a symbolic link (symlink) to the existing file as:
ln -s -f /usr/local/bin/Python3.7 /usr/local/bin/python
为了确保您可以关闭终端,然后再次将其打开以检查更改的默认版本,就像以前一样.
In order to be sure you can close your terminal and then open it again to check the changes default version as before.
python3 --version
这篇关于如何将默认的python3设置为python3.7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!