简体   繁体   English

如何将默认的python3设置为python3.7?

[英]How to set the default python3 to python3.7?

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).我的 Macbook 上有一个 Python 3.6.8 在 /usr/local/bin/Python3 和一个 Python 3.7.6 在 /usr/local/bin/Python3.7 在我的 Macbook 上(此外,还有 Mac 默认的 Python2,我没有不想改变它)。

By check which python3 or python3 --version , I can see the current default version is Python 3.6.8.通过检查which python3python3 --version ,我可以看到当前的默认版本是 Python 3.6.8。 I'd like to set the default Python3 to Python 3.7.6.我想将默认的 Python3 设置为 Python 3.7.6。 How can I do that?我怎样才能做到这一点?

You can use the "ln" command to create a symbolic link (symlink) to the existing file as:您可以使用“ln”命令创建指向现有文件的符号链接(symlink),如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM