Python3 on cygwin

9

3

How does one install Python3 on cygwin? I tried running the Python install in cygwin with no success.

The version I am looking for is >= 3.1, and I was able to install 2.7 successfully under cygwin (which comes with 2.6 as the default).

By the way, I would like to run Python3 as python3 and not python. I don't want conflicts with the default python binaries that come with cygwin.

Help!

eqb

Posted 2012-06-18T17:51:01.303

Reputation: 193

Answers

11

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

me_and

Posted 2012-06-18T17:51:01.303

Reputation: 2 118

when I do which python in cygwin terminal, it prints /cygdrive/d/Programs/python/python-3.6.6-amd64/python (that is it refers to the Windows python). When I do which python3 in cygwin terminal, it prints /usr/bin/python3 (this one is the one which I installed through cygwin setup). Do I need to fix this? – Maha – 2018-06-19T10:05:42.483

@Mahesha999 I suspect you'll get a better response and more visibility if you ask your question as a new question, rather than here. – me_and – 2018-06-20T12:11:43.637

yeah may be but I am equally anxious that people may downvote it – Maha – 2018-06-20T12:13:20.867

@Mahesha999 If you're clear about what you're asking, why you're asking, and what research you've already done, I find people very rarely downvote; IME downvoting questions tends to only be for the most egregiously unclear ones, not least because it costs people points to downvote. – me_and – 2018-06-21T12:42:41.960

super brilliant answer – Kumar Abhinav – 2020-01-24T04:26:14.737

brilliant! thanks for keeping the question in mind! – eqb – 2012-07-28T19:35:07.140

can't vote up, not enough rep :( – eqb – 2012-07-28T19:35:53.710

@ethiopianqubit you should be able to Mark this answer as accepted regardless of your rep, though - just click on the grey tick. – me_and – 2012-07-29T11:06:02.407

9

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

me_and

Posted 2012-06-18T17:51:01.303

Reputation: 2 118