Mac 修改默認python的版本


1.安裝Python 3
從官網下載:https://www.python.org/getit/

2.查看Python3 安裝路徑
打開終端,輸入which python3,查看路徑 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3

3.打開配置文件
vim ~/.bash_profile

4.寫入外部環境變量
export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.7/bin/python3

5.重命名Python
alias python="/Library/Frameworks/Python.framework/Versions/3.7/bin/python3"

6.關閉文件

7.終端執行命令:

source ~/.bash_profile

8.終端執行命令: python檢查Python版本

python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM