Mac下切换Python版本
2020-01-28 本文已影响0人
左木北鱼
1.查看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