mac更改python默认版本_Mac修改默认python版本

弄了一个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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值