弄了一个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
修改 ~/.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
来源:https://www.cnblogs.com/lijifei/p/9541978.html