且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在终端中切换Python版本?

更新时间:2023-12-05 21:58:22

最简单的方法是向python3添加别名,以始终指向已安装的本机python.最后将此行添加到$HOME目录中的.bash_profile文件中,

The simplest way would be to add an alias to python3 to always point to the native python installed. Add this line to the .bash_profile file in your $HOME directory at the last,

alias python="python3"

这样做可以使更改反映在每个打开的交互式shell上.

Doing so makes the changes to be reflected on every interactive shell opened.