当前位置:主页 > 软件编程 > Python代码 >

Python3 修改默认环境的方法

时间:2021-01-21 10:54:11 | 栏目:Python代码 | 点击:

Mac 环境中既有自带的 Python2.7 也有自己安装的 Python 3.5.1,默认想用 Python3 的环境

1. 添加 Python3 的环境变量

vi ~/.bash_profile 

# Setting PATH for Python 3.5
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH 

2. 添加别名

vi ~/.bashrc

alias python="/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5" 

3. 立即生效

source .bash_profile

您可能感兴趣的文章:

相关文章