[英]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.