Mac下切换Python版本

作者: beiyu 分类: Python 发布时间: 2020-01-28 12:09

1.查看python版本

Jiaheng:~ jiaheng$ which python

/usr/bin/python

Jiaheng:~ jiaheng$ which python3

/Library/Frameworks/Python.framework/Versions/3.8/bin/python3

Jiaheng:~ jiaheng$ which python3.8

/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8

2.修改版本

修改用户根目录下的~/.bash_profile文件,在终端输入:

Jiaheng:~ jiaheng$ open ~/.bash_profile

在文件中新增一行:

alias python=”/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8″

添加完之后执行:

Jiaheng:~ jiaheng$ source ~/.bash_profile

验证:

Jiaheng:~ jiaheng$ python –version

 
 
 

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

÷ 1 = 2