Mac下将Python2.7改为Python3

1,查看当前python 版本

python -v 小写v:这是版本信息,包括库版本

python -V 大写v:只看python的版本

which python3    查看安装路径

2,修改~/.bash_profile文件

# Setting PATH for Python 3.8

# The orginal version is saved in .bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"

export PATH 
 ### //增加这几行内容(如有则无需添加)

 alias python2='/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'

 alias python3='/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'

 alias python=python3

3,使得修改的 bash_profile文件 生效

source ~/.bash_profile

猜你喜欢

转载自www.cnblogs.com/developer-qin/p/12290740.html
今日推荐