如何判断mac和mac程序使用的是哪个python
我已经阅读了几个关于如何以及为什么这样做的问题和页面,但是昨天查看我的 mac 后,我发现我的机器上目前有 6 个版本的 python。
其中三个位于 /Library/Frameworks/Python.framework/Versions(2.5、3.1、3.2)中,然后在 /System/Library/Frameworks/Python.framework/Versions 中还有另外三个(2.5、2.6 和另一个)。
终端似乎从第一个路径开始使用 MacPython 2.5。我发现建议我让我的 Mac 本身使用 MacPython,并且我不会尝试改变这一点。我设法从第一个路径添加 3.2 引用到 $PATH,但终端似乎并没有真正识别这一点。
对于 Python 开发,我过去使用过 IDLE,但它没有任何语法突出显示,因此我转向了 TextMate。
我有几个问题: - 为什么有这么多版本并且都在使用? - 如何让所有程序使用相同版本? - 为什么有些版本有 IDLE,有些则没有,更重要的是,为什么没有的版本安装了所有“额外”,比如 PyOBjC?
I've read through several questions and pages on the how and why of this, but after taking a look on my mac yesterday I found that I currently have 6 versions of python on my machine.
Three are located in /Library/Frameworks/Python.framework/Versions (2.5, 3.1, 3.2), and then I have three more in /System/Library/Frameworks/Python.framework/Versions (2.5, 2.6, and another).
Terminal seems to use MacPython 2.5 from the first path. I found that it is recommended that I let my Mac itself use MacPython and that I don't try to change that. I managed to add a 3.2 reference from the first path to $PATH, but Terminal doesn't really seem to pick up on that.
For Python development I have used IDLE in the past, but it doesn't have any syntax highlighting, and so I moved over to TextMate.
I have several questions:
- Why are there so many versions and are they all being used?
- How can I get all programs to use the same version?
- Why do some versions have IDLE and some don't, and more importantly why do the ones that don't, have all the 'Extras' installed, like PyOBjC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何知道使用的是哪种Python:
在终端中,输入
which python
。它将向您显示活动 Python 的路径。为什么有这么多版本:
可能是之前系统升级的遗留物:Tiger ->豹纹->也许是雪豹。
如何将所有内容指向你想要的Python:
在您的
.profile
或.bashrc
中添加以下行:我建议通过以下方式安装 Python Mac 端口。它维护得很好,并带有一个 CLI“选择器”,允许您,呃……选择活动的 Python。
How to know which Python is the used:
In the Terminal, type
which python
. It will show you the path to the active Python.Why so many versions:
Probably leftovers of previous system upgrades: Tiger -> Leopard -> Snow Leopard, maybe.
How to point everything to the Python you want:
In your
.profile
or.bashrc
add the line:I'd recommend to install Python via MacPorts. It's well maintained and comes with a CLI "chooser" allowing you to, well… choose the active Python.