Python3 on cygwin

Solution 1:

As of yesterday (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.

This will still install as python3, leaving any existing 2.x install in place, just as before:

$ python -V
Python 2.6.8
$ python3 -V
Python 3.2.3
$ ls -l $(which python) $(which python3)
lrwxrwxrwx 1 me Domain Users 13 Jun 21 15:12 /usr/bin/python -> python2.6.exe
lrwxrwxrwx 1 me root         14 Jul 26 10:56 /usr/bin/python3 -> python3.2m.exe

Solution 2:

You can do this using Cygwin Ports, a bunch of programs that have been ported to Cygwin, but aren't ready for general release.

From that page:

  1. Use the latest Cygwin setup.exe (at least version 2.738).
  2. Launch setup.exe with the -K flag, e.g.:

      cygstart -- /path/to/setup.exe -K http://cygwinports.org/ports.gpg
    
  3. On Choose Installation Type page, select "Install from Internet".

  4. On Choose Download Site(s) page, select a distro mirror, then enter ftp://ftp.cygwinports.org/pub/cygwinports in the User URL field and press Add (making sure that both are highlighted).
    • Mirrors are available by instead entering http://downloads.sourceforge.net/cygwin-ports as the User URL.
    • Alternatively, you can use a sourceware mirror, but if you do, you must use one hosted on a different server than your selected distro mirror.
  5. Proceed with package selection and installation, making sure to install any indicated dependencies.

Note that the two links provided didn't work for me; I'd expect FTP not to work as it's restricted by my firewall, but I think the alternative Sourceforge link is duff, and should be http://sourceforge.net/projects/cygwin-ports/files/. Using that URL worked fine for me.

From there, you should be able to select to install the python3 package. It's currently giving version 3.1.5rc1-1.

It does install as python3, leaving my existing python install as v2.6.8:

$ python -V
Python 2.6.8
$ python3 -V
Python 3.1.5rc1
$ ls -l $(which python) $(which python3)
lrwxrwxrwx 1 me root         13 Jun 12 13:43 /usr/bin/python -> python2.6.exe
lrwxrwxrwx 1 me Domain Users 13 Jun 19 10:51 /usr/bin/python3 -> python3.1.exe