简体   繁体   English

更改OSX Mountain Lion中的默认python

[英]Changing the default python in OSX Mountain Lion

I installed Python through MacPorts, and then changed the path to that one. 我通过MacPorts安装了Python,然后将路径更改为该路径。

/opt/local/bin/python

using this command 使用此命令

sudo port select python python27

But now i want to revert to the Mac one at this path 但现在我想在这条道路上恢复到Mac

/usr/bin/python

How can I go about doing this? 我该怎么做呢?

EDIT: 编辑:

I uninstalled the MacPort Python, restarted the terminal and everything went back to normal. 我卸载了MacPort Python,重新启动终端,一切都恢复正常。 Strange. 奇怪。 But I sill don't know why/how. 但我不知道为什么/如何。

The sudo port select command only switches what /usr/local/bin/python points to, and does not touch the /usr/bin/python path at all. sudo port select命令只切换/usr/local/bin/python指向的内容,并且根本不触及/usr/bin/python路径。

The /usr/bin/python executable is still the default Apple install. /usr/bin/python可执行文件仍然是默认的Apple安装。 Your $PATH variable may still look in /usr/local/bin before /usr/bin though when you type in python at your Terminal prompt. 你的$PATH变量可能还是看在/usr/local/bin之前/usr/bin ,虽然当你键入python在终端上的提示。

Try 尝试

sudo port select python python27-apple

You can use port select --list python to list all python versions available via ports. 您可以使用port select --list python列出通过端口可用的所有python版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM