1.查看python版本
/usr/bin/pythonJiaheng:~ jiaheng$ which python3/Library/Frameworks/Python.framework/Versions/3.8/bin/python3Jiaheng:~ 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
![c8e78730d7c840bef8ac9b7ba62d502b.png](https://i-blog.csdnimg.cn/blog_migrate/c0fcd4e95c12ddc88e5408e6f7d35dea.jpeg)