Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3.x in Cygwin?

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

like image 749
kevlar1818 Avatar asked Jan 16 '23 07:01

kevlar1818


1 Answers

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.

like image 171
me_and Avatar answered Jan 28 '23 18:01

me_and