简体   繁体   中英

Which version of python is currently best for os x?

After going through hell trying to install the latest version of postgresql and psycopg2 today I'm going for a complete reinstall of Leopard.

I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6

For me it's most important for Twisted, PIL and psycopg2 to be working without a problem.

Can anyone give some guidelines for what version I should choose, based on experience?

Edit:

Ok I've decided to go without reinstalling the os. Hacked around to clean up the bad PostgresPlus installation and installed another one. The official python 2.6.1 package works great, no problem installing it alongside 2.5.2. Psycopg2 works. But as expected PIL wont compile.

I guess I'll be switching between the 2.5 from macports and the official 2.6 for different tasks, since I know the macports python has it's issues with some packages.

Another Edit:

I've now compiled PIL. Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones. It wouldn't accept the paths I was feeding it. PIL is notorious for this on leopard.

You can install them side-by-side. If you've encounter problems just set python 2.5 as the standard python and use eg python26 for a newer version.

I still use macports python25, because so many other packages depend on it, and have not updated to use python26.

$ port dependents python25
gnome-doc-utils depends on python25
mod_python25 depends on python25
postgresql83 depends on python25
gtk-doc depends on python25
at-spi depends on python25
gnome-desktop depends on python25
mercurial depends on python25

And that's excluding the py25-* packages I have installed.

I wrote something today on this very subject, my recommendation? Run multiple version, and slap virtualenv down to compartmentalize things.

http://jessenoller.com/2009/03/16/so-you-want-to-use-python-on-the-mac/

I also wouldn't both with macports. I don't see a need for it.

I've updated my macbook running leopard to python 2.6 and haven't had any problems with psycopg2. For that matter, I haven't had any compatibility issues anywhere with 2.6, but obviously switching to python3k isn't exactly recommended if you're concerned about backwards compatibility.

I would stick with the MacPython version 2.5.x (I believe 2.5.4 currently). Here's my rationale:

  1. Snow Leopard may still be on the 2.5 series, so you might as well be consistent with the future OS (ie no point in going too far ahead).
  2. For most production apps, nobody is going to want to use 2.6 for another year.
  3. No frameworks/programs are going to leave 2.5 behind for at least 2 years.

In other words, my approach is that the only reason to do 2.6 is for fun. If you're looking to have fun, just go for 3.0.

I use both Twisted and Psycopg2 extensively on OSX, and both work fine with Python 2.6. Neither has been ported to Python 3.0, as far as I know.

Several of Python 3.0's features have been back-ported to 2.6, so you gain quite a bit by moving from 2.5 to 2.6. But I wouldn't switch to 3.0 until all of your thirdparty libraries support it; and this may not happen for some time.

I had some trouble installing PIL. I compiled it and it worked with the modification explained on this post http://passingcuriosity.com/2009/installing-pil-on-mac-os-x-leopard/ After that it worked fine.

If your using Macports, I recommend downloading the python_select package, which facilitates easy switching between different versions including the built in apple versions. Makes life a lot easier.

I am using Python 2.5.1. It's working great for me for general scripting and some CherryPy web projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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