为什么我的 Snow Leopard 在 /usr/bin 中安装了这么多 Python?是什么决定了哪一个是系统Python?
为什么我的 Snow Leopard 在 /usr/bin 中安装了这么多 Python?是什么决定了哪一个是系统Python?
当我简单地输入“python”时,它是2.6.1〜但这似乎不是“System Python”,为什么不呢?如何改变Python系统以及有哪些缺点?
Why is there so many Pythons installed in /usr/bin for my Snow Leopard? What decides which one is the System Python?
When I simply type "python" it is 2.6.1 ~ but this doesn't seem to be the "System Python", why not? How does one change system Python and what are the drawbacks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的雪豹只安装了python 2.5和2.6,所以数量不是很多。您可能安装了其他 python(即 python3.0),可以在系统范围内(在 /usr/bin/ 中)或通过 macports (/opt/local)。
默认系统python是通过设置定义的,
将默认值更改为2.5。您还可以使用环境变量,即对于 bash:
所有这些都记录在 python 手册页中,
总的来说,最好不要更改系统默认值。这是 OSX 可能依赖的某些脚本,并且您永远不知道这些脚本在不同版本上是否按预期工作。尤其是Python 3 不同,可能真的会破坏你的整个系统。
如果您希望为自己的脚本使用不同的 python,请
My snow leopard only has python 2.5 and 2.6 installed, so it's not that many. You may have additional pythons installed (i.e. python3.0), either system wide (in /usr/bin/) or through macports (/opt/local).
The default system python is defined through a setting,
will change the default to 2.5. You can also use an environment variable, i.e. for bash:
All of this is documented in the python manpage,
Overall, it's better not to change the system default. It's what OSX may depend on for certain scripts, and you never know if these scripts work as expected on different versions. Especially Python 3 is different, and may really break your whole system.
If you want a different python to be used for your own scripts, either