使用Python 2.6?

5
我无法升级到Python 2.7或3.1,所以我在我的Ubuntu 10.04机器上被困在Python 2.6上。
我是否仍然能够找到支持Python 2.6的主机?
使用Python 2.6是否仍然被认为是过时或不良实践?

2.6和2.7在很大程度上是兼容的 - 在2.6上运行的程序很可能也会在2.7上正常运行。 - Amber
你可以尝试我的squeeze构建配方 - Faheem Mitha
4个回答

4

2.6版本将长期存在。仍有许多机器运行着2.4版本,所以您不用担心。


3

Python 2.6 可能还会存在一段时间,因为 Python 2.7 发布仅几个月。

你可以始终使用 from __future__ import ... 来利用 Python 3.x 中的一些新特性。


0

Python3.1已经在10.04的软件库中了

$ apt-cache show python3
Package: python3
Priority: optional
Section: python
Installed-Size: 76
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko@debian.org>
Architecture: all
Source: python3-defaults
Version: 3.1.2-0ubuntu1
Depends: python3.1 (>= 3.1.2), python3-minimal (= 3.1.2-0ubuntu1)
Suggests: python3-doc (>= 3.1.2-0ubuntu1), python3-tk (>= 3.1.2-0ubuntu1), python3-profiler (>= 3.1.2-0ubuntu1)
Filename: pool/main/p/python3-defaults/python3_3.1.2-0ubuntu1_all.deb
Size: 11096
MD5sum: 81f3f3bf790f5d7756b76c8d92fcea86
SHA1: 32e12dc7f9500456e063f22645c1cfed76b8845c
SHA256: 0f541352ace2fcf1929a93320ffbe2f1de4e1d140bbe70a7c5a709403b73341c
Description: An interactive high-level object-oriented language (default python3 version)
 Python, the high-level, interactive object oriented language,
 includes an extensive class library with lots of goodies for
 network programming, system administration, sounds and graphics.
 .
 This package is a dependency package, which depends on Debian's default
 Python version (currently v3.1).
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 3y

0

我还能找到支持Python 2.6的主机吗?

可以,没有任何问题。

使用Python 2.6仍然被认为是过时或不好的做法吗?

不,不是这样的。

但是:

我没有升级到Python 2.7的方法。

有的。您可以从www.python.org下载源代码并安装它。 您应该小心地做到不要覆盖系统Python。

使用“altinstall”(不会覆盖系统Python)或者更好的方法是使用自定义前缀进行安装。例如:

$ ./configure --prefix = /opt/python27
$ make
$ sudo make install

通常在开发时使用单独的Python安装是个好主意,因为你可以随意操作它,包括删除和重新安装,而不会影响系统Python。

你并不会被卡住。 :)

我也使用Ubuntu 10.04,我安装了Python 2.3.7、2.4.6、2.5.5、2.6.6、2.7.1、3.0.1、3.1.2和3.2b2+。没有问题。是的,我使用它们中的所有版本,尽管主要是2.4和2.6。


您之前回答过这个问题,但我可以问一下您如何选择使用哪个版本吗? - la_f0ka
@la_f0ka:你使用能用的最新版本。只有你知道你能用哪些版本。 - Lennart Regebro

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接