
如何设置python默认使用python3
1个回答
展开全部
*** 1. 终端打开.bash_profile文件 ***
open ~/.bash_profile
*** 2. .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
*** 3. 添加别名->最终文件 ***
alias python="/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5"
*** 4. 终端中重新读取.bash_profile文件 ***
source .bash_profile12345678910111213141234567891011121314
此时,在终端中输入python,应该就是python3的环境了。
注意:添加时,路径的双引号。
open ~/.bash_profile
*** 2. .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
*** 3. 添加别名->最终文件 ***
alias python="/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5"
*** 4. 终端中重新读取.bash_profile文件 ***
source .bash_profile12345678910111213141234567891011121314
此时,在终端中输入python,应该就是python3的环境了。
注意:添加时,路径的双引号。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |