美文网首页Python
Mac Python升级

Mac Python升级

作者: 887d1fc86fe6 | 来源:发表于2017-08-10 17:32 被阅读61次

强烈建议不要直接sudo ln -s (会直接覆盖系统原来的link导致想调用自带python的软件出现问题),修改path variable虽然比较安全,但对于你的需要是没有太大必要的。

升级步骤:

1. 官网下载需要用到的版本 https://www.python.org/ 安装

2. command + shift + G 输入 ~ 符号回车 找到 .bash_profile 双击打开

如果没有 .bash_profile 则使用命令行自行添加:(有文件的跳过)

1) cd ~

2)touch .bash_profile

3)回到第二步

3. 添加一下代码

alias python="/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6"

command + s 保存 

注意:  alias python= 后面的路径是你下载安装到本地的路径 下载安装的Python版本都在 /Library/Frameworks/Python.framework/Versions 这个路径下 可使用 command + shift + G 进行找到

然后退出退出Terminal 重新打开输入 python --version 就是你指定的版本了

相关文章

网友评论

    本文标题:Mac Python升级

    本文链接:https://www.haomeiwen.com/subject/ogohrxtx.html