cho*_*ise 5 mac python osx-snow-leopard installation macos
我想用我的 Mac 学习 Python。
现在想设置一个>=3.1.3的Python版本,因为我的学习资料都是用这个版本的。
输入python终端结果版本 2.6.1,使用 python.org上的 dmg 安装程序对终端中的 python 版本没有影响,但它与自己的 shell 捆绑在Applications/Python 3.1/Idle.app
我应该使用这个 shell 来学习还是有更好的方法,更新与雪豹捆绑在一起的 Python 版本?
我已经尝试过defaults write com.apple.versioner.python Version 3.1.3或defaults write com.apple.versioner.python Version 3.0没有任何结果。
Python 3 破坏了一些东西。这就是为什么它没有取代 Python 2,但python仍然启动 2。
要获取 Python 3,请输入python3. 您可能需要$PATH通过编辑~/.bash_profile和添加来更改:
PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin:${PATH}"
export PATH
Run Code Online (Sandbox Code Playgroud)
您可以定义一个 shell 函数或别名来映射python到python3,这样旧脚本将继续运行,并且您可以键入python并获取版本 3。
添加.bash_profile:
alias python='python3'
Run Code Online (Sandbox Code Playgroud)
/usr/bin/env python继续提供Python 2。
| 归档时间: |
|
| 查看次数: |
1710 次 |
| 最近记录: |