'Status of Python 3.7 in Cygwin
Does anyone have a way to install python 3.7 in latest stable Cygwin 32 or 64 bit that works out of the box without hacking? I've noticed that 3.6 works fine but 3.7 libraries don't behave and are missing key functionality.
I have usecases to have Cygwin for various scripts but want to use 3.7 for its improvements with type annotations. The new Linux runtime is not available on my servers so Cygwin is the only decent posix environment I can run in my windows servers.
[Update - 2022-03-30] I recently have successfully gotten Python 3.9 working on Cygwin. It does create proper python3 and pip3 executables out of the box. Only issues need to install cryptography==3.3.2 and pyopenssl<=21.0.0 due to rust dependency.
Solution 1:[1]
Although Timothy's answer is correct, the cleaner way to do this is to ensure Cygwins 'alternative' package is installed and run the following commands in order to have your Python versions switchable through the alternative system. This will also switch to the correct pip versions.
/usr/sbin/update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 0 --slave /usr/bin/pip3 pip3 /usr/bin/pip3.6
/usr/sbin/update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 10 --slave /usr/bin/pip3 pip3 /usr/bin/pip3.7
/usr/sbin/update-alternatives --install /usr/bin/python python /usr/bin/python3 10 --slave /usr/bin/pip pip /usr/bin/pip3
/usr/sbin/update-alternatives --set python3 /usr/bin/python3.7
/usr/sbin/update-alternatives --set python /usr/bin/python3
In case you still need deprecated Python 2.x versions you can add these accordingly as an alternative for 'python' via a 'python2' group.
Solution 2:[2]
The python37 packages will install correctly but will create an executable called python3.7 instead of python3 which can be confusing. I would guess that the Cygwin dev's wanted to allow two versions of python3 to be installed at the same time.
However, as its not recommended to have two versions of python3 installed at the same time, you can simply create the executable python3 as follows to correct this:
ln -s /usr/bin/python3.7 /usr/bin/python3
The same goes for python37-pip:
ln -s /usr/bin/pip3.7 /usr/bin/pip3
These instructions above will likely apply to other non-standard version of python on Cygwin although I have only tested Python37.
For those who need to install pyopenssl package, you will need the following cygwin packages: gcc-g++, libffi-devel, libssl-devel, python37-devel
For pandas, you will need python37-numpy package and be sure to upgrade it in pip before installing pandas as there is a known bug in numpy package version in cygwin:
pip3 install --upgrade numpy
pip3 install pandas
Solution 3:[3]
python3 defaults to python 3.6 but python 3.7 is available in packages. Once installed you can run using:
$ python3.7 -V
Python 3.7.3
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | haemka |
| Solution 2 | Timothy C. Quinn |
| Solution 3 | webh |
