简体   繁体   English

Python2.6是否足够稳定以供生产使用?

[英]Is Python2.6 stable enough for production use?

还是我应该坚持使用Python2.5更长的时间?

From python.org : python.org

The current production versions are Python 2.6.2 and Python 3.0.1. 当前的生产版本是Python 2.6.2和Python 3.0.1。

So, yes. 所以,是的。

Python 3.x contains some backwards incompatible changes, so python.org also says: Python 3.x包含一些向后不兼容的更改,因此python.org也说:

start with Python 2.6 since more existing third party software is compatible with Python 2 than Python 3 right now 从Python 2.6开始,因为现在比Python 3兼容的第三方软件与Python 2兼容

Ubuntu has switched to 2.6 in it's latest release, and has not had any significant problems. Ubuntu在其最新版本中已切换到2.6,并且没有任何重大问题。 So I would say "yes, it's stable". 所以我会说“是的,它很稳定”。

It depends from libraries you use. 这取决于您使用的库。 For example there is no precompiled InformixDB package for 2.6 if you have to use Python on Windows. 例如,如果必须在Windows上使用Python,则没有针对2.6的预编译InformixDB软件包。

Also web2py framework sticks with 2.5 because of some bug in 2.6. 由于2.6中的某些错误,web2py框架也坚持使用2.5。

Personally I use CPython 2.6 (workhorse) and 3.0 (experimental), and Jython 2.5 beta (for my test with JDBC and ODBC). 我个人使用CPython 2.6(主力)和3.0(实验性)以及Jython 2.5 beta(用于JDBC和ODBC的测试)。

Yes it it, but this is not the right question. 是的,但这不是正确的问题。 The right question is "can I use Python 2.6, taking in consideration the incompatibilities it introduces ?". 正确的问题是“考虑到它带来的不兼容性,我可以使用Python 2.6吗?”。 And the short answser is "most probably yes, unless you use a specific lib that wouldn't work with 2.6, which is pretty rare". 而且简短的答案是“很可能是,除非您使用无法在2.6上使用的特定库,这很少见”。

I've found 2.6 to be fairly good with two exceptions: 我发现2.6很好,但有两个例外:

  1. If you're using it on a server, I've had trouble in the past with some libraries which are used by elements of the server (Debian Etch IIRC). 如果您在服务器上使用它,那么过去,我遇到了一些由服务器元素使用的库的问题(Debian Etch IIRC)。 It's possible with a bit of jiggery pokery to maintain several versions of python in unison though if you're careful :-) 如果您要小心的话,有一点点奇特的扑克可能会一致地维护多个版本的python :-)
  2. This is no-longer true, but the last time I tried 2.6, wxPython had not been updated which meant all my gui tools I've written broke. 不再是这样,但是上一次我尝试2.6时,wxPython尚未更新,这意味着我编写的所有gui工具都坏了。 There's now a version available that's built against 2.6. 现在有一个针对2.6构建的版本。

So I'd suggest you check all the modules you use and check their compatibility with 2.6... 因此,我建议您检查所有使用的模块,并检查它们与2.6的兼容性...

I recently switched from python2.5 to 2.6 for my research project involving lots of 3rd party libs (scipy, pydot, etc.) and swig related stuff. 最近,我的研究项目从python2.5切换到2.6,涉及很多第三方库(scipy,pydot等)和swig相关的东西。

The only thing I had to change was to convert all strings with 我唯一需要更改的是将所有字符串转换为

s = unicode(s, "utf-8") s = unicode(s,“ utf-8”)

before I fed them into the logging module. 在将它们输入日志记录模块之前。

Otherwise, I got everytime 不然我每次都会

Traceback (most recent call last): 追溯(最近一次通话):
File "/usr/lib/python2.6/logging/__init__.py", line 773, in emit 发出文件“ /usr/lib/python2.6/logging/__init__.py”,行773
stream.write(fs % msg.encode("UTF-8")) stream.write(fs%msg.encode(“ UTF-8”))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 31: ordinal not in range(128) UnicodeDecodeError:'ascii'编解码器无法解码位置31的字节0xe2:序数不在范围内(128)

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

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