Mac配置环境变量不像winsows,没有窗口界面只能通过命令行指令进行配置,下面是Mac配置python环境变量的步骤
1.打开Mac自带终端Terminal;
2、在终端Terminal输入下面的命令:Python3 --version
输入
python --V没反应
。但是输入
python3 --V
,显示了
Python 3.6.8
说明,已经安装了python3。看苹果官方,说是内置的python 升级为了python3,python2不再内置了。
3.编辑bash_profile文件
vim .bash_profile
按E进入编辑
在安i进入插入模式(就可以编辑文件了)
输入Python安装的路径环境变量命令:
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
4、保存退出
先按esc键退出插入模式,再按 : 进入底行模式 再输入 wq 保存退出
5.重新加载配置文件
.bash_profile
输入 source
.bash_profile
到此python环境就配好了
版权归原作者 余炜yw 所有, 如有侵权,请联系我们删除。