1.查看python版本
<code>/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
/<code>
2.修改版本
- 修改用戶根目錄下的~/.bash_profile文件,在終端輸入:
<code>Jiaheng:~ jiaheng$ open ~/.bash_profile
/<code>
- 在文件中新增一行:
<code>alias python=”/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8″
/<code>
- 添加完之後執行:
<code>Jiaheng:~ jiaheng$ source ~/.bash_profile/<code>
- 驗證:
<code>Jiaheng:~ jiaheng$ python –version/<code>
閱讀更多 ITCAN 的文章