在Cygwin中的Python 3.x? [英] Python 3.x in Cygwin?

查看:341
本文介绍了在Cygwin中的Python 3.x?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上的Cygwin中有 python 包。但是,键入

  python -V 

返回

  Python 2.6.8 

的Python ...我可以使用Python 3.x(任何版本是最新的,最好)。我看到有些人说你必须手动下载 .zip .tar 才能得到它(类似于问题)。我的问题如下(请注意,这不是重复的链接问题):




  • 我可以使用Python 3.x Cygwin软件包管理器?

  • 如果我设法让Python 3.x运行,是否可以删除Python 2.6?我的代码没有运行任何特定于Python 2.6的东西。



感谢

解决方案

其他人已经注意到,安装Cygwin的Python 2.6版本是最近的; Python版本号相对于时间不是线性的。 Python版本网页详细说明了在哪个日期发布的版本。



你可以使用Cygwin Ports来安装Python3。这是一个Cygwin包的集合,这些包在Cygwin主镜上未准备好进行一般发布,但已经编译好,可以在Cygwin上使用了。我在SuperUser 上撰写了一些说明,更详细地描述了如何执行此操作。



(我会避免从源代码安装,如 Lennart 建议,因为我预计这将需要非平凡的修补程序,使其工作在Cygwin。)



如上面的SuperUser问题所述,没有必要卸载Python 2.6来安装Python 3;



这就是说,请注意,我的代码都不能运行在特定于Python 2.6的任何代码上:Python 3.x是不是回来与Python 2.x兼容,为Python 2.x编写的代码通常不适用于Python 3.x,没有工作来适应它。 Python 3.0.1新功能指南有很好的概述

更新:自2012年7月25日(星期三)起, Python 3.2.3包含在标准Cygwin安装程序中。再次运行Cygwin的 setup.exe (从 cygwin.com < a>再次,如果你需要),你应该能够像任何其他包一样选择和安装它。


I have the python package in Cygwin on Windows 7. However, typing

python -V

returns

Python 2.6.8

This is a pretty low version of Python... I could use Python 3.x (whatever version is newest, preferably). I've seen some people say you have to download a .zip or .tar manually to get it (similar to this question). My questions are as follows (please note this is NOT a duplicate of the linked question):

  • Can I get Python 3.x somehow using the Cygwin package manager?
  • Can/should I get rid of Python 2.6 if I manage to get Python 3.x running? None of my code runs on anything specific to Python 2.6.

Thanks

解决方案

As others have noted, the version of Python 2.6 that's installed with Cygwin is recent; Python release numbers are not linear with respect to time. The Python releases page details which versions were released on which date.

You can install Python3 if you want, using Cygwin Ports. This is a collection of Cygwin packages that are not ready for general release on the main Cygwin mirrors, but have been compiled ready to be used on Cygwin. I've written some instructions over on SuperUser which describe in more detail how to do this.

(I'd avoid installing from source, as Lennart suggests, as I'd expect this will require non-trivial fixes to make it work on Cygwin.)

As noted in the above-linked SuperUser question, there's no need to uninstall Python 2.6 to install Python 3; the two run happily side-by-side.

That said, beware your claim that "None of my code runs on anything specific to Python 2.6": Python 3.x is not back compatible with Python 2.x, and code written for Python 2.x will generally not work on Python 3.x without work to adapt it. The Python 3.0.1 What's New Guide has a good overview of the changes in Python 3.x.

Update: As of Wed 25 July 2012, Python 3.2.3 is included in the standard Cygwin installer. Just run Cygwin's setup.exe again (download it from cygwin.com again if you need to), and you should be able to select and install it like any other package.

这篇关于在Cygwin中的Python 3.x?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆