弄了一個mac pro 玩發現 Mac默認的python版本為2.7 自己安裝了3.7的版本
修改 ~/.bash_profile 文件
查看python3安裝路徑
which python3 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
編輯~/.bash_profile
vi ~/.bash_profile
按i進入編輯模式
添加PATH,alias
#add PATH export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.7/bin #alias python alias python2='/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7' alias python3='/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7' alias python=python3 #alias pip alias pip='/Library/Frameworks/Python.framework/Versions/3.7/bin/pip3'
保存~/.bash_profile
esc退出編輯模式
:wq保存
生效~/.bash_profile
source ~/.bash_profile