开发者

MacPorts on Snow Leopard: Python install seems to succeed but doesn't install a non-system Python

I've installed Python via MacPorts. According to this question, the files in /opt/local/bin should run the "correct" Python version. However, all those files are symlinks to:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ 

Running them directly from that folder (using no symlinks) runs an Apple build of Python!

Python 2.6.6 (r266:84292, Jan  6 2011, 13:25:25) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

For comparison, running /usr/bin/python shows a slightly different version:

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>&开发者_高级运维gt;>

They're both Apple builds! How do I install the correct version?


There are no "Apple builds" except the system Python (which is 2.6.1 on Snow Leopard, afai can deduce). The ports install seems to have worked as expected in this case. The reference to Apple is a reference to which GCC that was used.


I think it is running the build you want.

macports install every thing in /opt/local. So /opt/local/bin/python is a macport distribution.

/usr/bin/python is pre-install python distribution that comes with mac os x.

The following line, is an information about gcc build which is used for building macport python distribution.

[GCC 4.2.1 (Apple Inc. build 5664)]

If you have multiple versions of macport python installed, you can select the version using python-select

sudo port install python-select sudo
python-select python26

Also to ensure that you use macport python you could add the following to the PATH

export PATH=/opt/local/bin:$PATH
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜