如何在 Ubuntu 11.10 中使用 Python 2.6?
Ubuntu 11.10 上的默认 Python 版本是 2.7,但我正在寻找 2.6。如何将其设置为默认值以及可执行文件位于何处?
我输入 which python2.6
但它什么也没返回,但我在 /usr/lib/python2.6
下确实有一个 python2.6 文件夹。但它看起来不像python2.7,它位于相同的路径/usr/lib/
。在python2.6中,有两个文件夹:dist-packages
和lib-dynload
。
实际上我正在配置 PyDev,它要求我指定 python2.6 可执行文件的位置。只需使用自动配置即可轻松找到 python2.7 可执行文件,因为它是默认的。
The default version of Python on Ubuntu 11.10 is 2.7, but I'm looking for 2.6. How do I make it default and where is the executable located?
I type which python2.6
but it returns nothing, yet I did have a python2.6 folder under /usr/lib/python2.6
. But it doesn't look like the python2.7 which is at the same path /usr/lib/
. Inside the python2.6, there are two folders: dist-packages
and lib-dynload
.
Actually I am configuring PyDev, and it requires me to specify where the python2.6 executable is. The python2.7 executable has been easily located by just using auto configuration as it is the default.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以安装包
python2.6
(apt-get install python2.6
)。此时,Python 的默认版本仍为 2.7。您可以通过以下方式更改此设置:请注意,这很有可能会导致您的系统出现问题。一些脚本假定 Python 的默认版本是 2.7,并且在不同版本下运行时可能会中断。如果您有一个明确需要 Python 2.6 的脚本,您可以在脚本的开头添加一个 shebang 来指定版本
You can install the package
python2.6
(apt-get install python2.6
). At this point, the default version of Python will still be 2.7. You can change this viaNote that there's a decent chance this could cause problems with your system. Several scripts assume the default version of Python is 2.7 and may break when run under a different version. If you have a script that explicitly requires Python 2.6, you can add a shebang at the beginning of your script to specify the version
在许多系统上,Python 的一个版本是默认的。其余的按名称和版本号调用:
根据 发行说明,这些应该是在梦魇中可用。
您的其他问题:
$ which python2.6
来找出答案。On many systems, one version of python is the default. The rest get called by their name and version number:
Per the release notes, these should be available in Oneiric.
Your other questions:
$ which python2.6
to find out.