且构网

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

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

更新时间:2023-12-05 22:10:34

最简单的方法是给 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.