简体   繁体   English

哪个版本的 python 目前最适合 os x?

[英]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.在经历了地狱尝试安装最新版本的 postgresql 和 psycopg2 之后,我今天要完全重新安装 Leopard。

I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6过去一年我一直坚持使用 macpython 2.5,但现在我正在考虑使用 macports 甚至 2.6

For me it's most important for Twisted, PIL and psycopg2 to be working without a problem.对我来说,最重要的是 Twisted、PIL 和 psycopg2 能够正常工作。

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.好的,我决定在不重新安装操作系统的情况下使用 go。 Hacked around to clean up the bad PostgresPlus installation and installed another one.四处乱砍以清理不良的 PostgresPlus 安装并安装了另一个。 The official python 2.6.1 package works great, no problem installing it alongside 2.5.2.官方的 python 2.6.1 package 效果很好,与 2.5.2 一起安装没问题。 Psycopg2 works. Psycopg2 有效。 But as expected PIL wont compile.但正如预期的那样,PIL 不会编译。

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.我想我会在 macports 的 2.5 和官方的 2.6 之间切换以完成不同的任务,因为我知道 macports python 的某些软件包存在问题。

Another Edit:另一个编辑:

I've now compiled PIL.我现在已经编译了 PIL。 Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones.必须隐藏整个 macports 目录和一半的 xcode 库,这样才能找到正确的库。 It wouldn't accept the paths I was feeding it.它不会接受我喂它的路径。 PIL is notorious for this on leopard. PIL 因在豹上而臭名昭著。

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.如果您遇到问题,只需将 python 2.5 设置为标准 python 并将例如python26用于更新版本。

I still use macports python25, because so many other packages depend on it, and have not updated to use python26.我仍然使用 macports python25,因为很多其他包都依赖它,并且没有更新为使用 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.这不包括我安装的py25-*软件包。

I wrote something today on this very subject, my recommendation?我今天就这个主题写了一些东西,我的建议? Run multiple version, and slap virtualenv down to compartmentalize things.运行多个版本,然后将 virtualenv 拍下来以划分事物。

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

I also wouldn't both with macports.我也不会同时使用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.我已经将运行 leopard 的 macbook 更新到 python 2.6,并且 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.就此而言,我在 2.6 的任何地方都没有遇到任何兼容性问题,但如果您担心向后兼容性,显然不建议您切换到 python3k。

I would stick with the MacPython version 2.5.x (I believe 2.5.4 currently).我会坚持使用 MacPython 版本 2.5.x(我相信目前是 2.5.4)。 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). Snow Leopard 可能仍然在 2.5 系列上,因此您不妨与未来的操作系统保持一致(即,走得太远没有意义)。
  2. For most production apps, nobody is going to want to use 2.6 for another year.对于大多数生产应用程序,没有人愿意再使用 2.6 年。
  3. No frameworks/programs are going to leave 2.5 behind for at least 2 years.任何框架/程序都不会在至少 2 年内将 2.5 抛在后面。

In other words, my approach is that the only reason to do 2.6 is for fun.换句话说,我的做法是,做 2.6 的唯一原因是为了好玩。 If you're looking to have fun, just go for 3.0.如果您想玩得开心,只需 go 3.0。

I use both Twisted and Psycopg2 extensively on OSX, and both work fine with Python 2.6.我在 OSX 上广泛使用 Twisted 和 Psycopg2,两者都可以在 Python 2.6 上正常工作。 Neither has been ported to Python 3.0, as far as I know.据我所知,两者都没有移植到 Python 3.0。

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. Python 3.0 的一些功能已向后移植到 2.6,因此通过从 2.5 迁移到 2.6,您可以获得相当多的收益。 But I wouldn't switch to 3.0 until all of your thirdparty libraries support it;但是在所有第三方库都支持之前,我不会切换到 3.0; and this may not happen for some time.这可能在一段时间内不会发生。

I had some trouble installing PIL.我在安装 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.我编译了它,它与这篇文章http://passingcuriosity.com/2009/installing-pil-on-mac-os-x-leopard/中解释的修改一起工作,之后它工作正常。

If your using Macports, I recommend downloading the python_select package, which facilitates easy switching between different versions including the built in apple versions.如果您使用 Macports,我建议下载 python_select package,它可以方便地在不同版本之间轻松切换,包括内置的苹果版本。 Makes life a lot easier.让生活轻松很多。

I am using Python 2.5.1.我正在使用 Python 2.5.1。 It's working great for me for general scripting and some CherryPy web projects.它对我来说非常适合一般脚本和一些 CherryPy web 项目。

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

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