开发者

How to determine which python is used by mac and mac programs

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 p开发者_Go百科ython 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?


  1. How to know which Python is the used:

    In the Terminal, type which python. It will show you the path to the active Python.

  2. Why so many versions:

    Probably leftovers of previous system upgrades: Tiger -> Leopard -> Snow Leopard, maybe.

  3. How to point everything to the Python you want:

    In your .profile or .bashrc add the line:

     alias python='/path/to/the/python/of/your/choice'
    

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜