Mac下修改默认Python路径

自己记录一下,从博客
https://blog.csdn.net/mghhz816210/article/details/73088406
学得

首先打开配置文件
open ~/.bash_profile

然后修改你的Python路径,我自己安装的Python是3.7
(路径是: /Library/Frameworks/Python.framework/Versions/ )
(另外,系统自带的Python路径是
/System/Library/Frameworks/Python.framework/Versions/ )

在打开的文件添加如下两行命令
export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.7/bin

alias python="/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"

最后保存文件并关闭
在终端中运行
source ~/.bash_profile

然后在终端中输入Python 查看是否已经更改为你希望的Python版本

你可能感兴趣的:(python)