While the current official Python version is 3.6, msys2 provides two packages for python3
:
msys/python3
, currently using 3.4
This is probably kind of late, but I use the native Windows install of python in MSYS2. The way I did this was to ensure that Python added the environment variable. After this, I created a new Windows environment variable PYTHONPATH=C:\Users\Glen.Nicholls\AppData\Local\Programs\Python\Python37\Lib\site-packages
. I also set MSYS to inherit in the MINGW64.ini
. Now, I add the alias for pip
and python
to my .bashrc:
alias python='$PYTHONPATH/../../python.exe'
alias pip='$PYTHONPATH/../../Scripts/pip.exe'
This isn't the cleanest solution, but it works in my environment just fine. Also, keep in mind that if you run which python
it will not point to the correct install.
Another method without creating aliases and all the above would be to change your PATH to include the inherited Windows PATH before the msys PATH. You can either edit this manually or put something fancy in your .bash_profile or .bashrc.
This is what I'm using on msys2 to install python3:
$ pacman -Syuu
Close and restart msys2.
$ pacman -S mingw-w64-x86_64-python3-bsddb3 mingw-w64-x86_64-gexiv2 mingw-w64-x86_64-ghostscript mingw-w64-x86_64-python3-cairo mingw-w64-x86_64-python3-gobject mingw-w64-x86_64-python3-icu mingw-w64-x86_64-iso-codes mingw-w64-x86_64-hunspell mingw-w64-x86_64-hunspell-en mingw-w64-x86_64-enchant
To deal with this error "No intltool or version < 0.25.0, build_intl is aborting" perform the following:
$ pacman -S intltool
Add these to test:
$ pacman -S mingw-w64-x86_64-python3-lxml
$ pacman -S mingw-w64-x86_64-python3-jsonschema
Execute this command to verify python3 is properly installed:
$ python3 --version
Python 3.6.4
For details please see https://www.gramps-project.org/wiki/index.php?title=Gramps_for_Windows_with_MSYS2
It can be confusing why there are two versions of Python, but both serve different use cases:
MINGW refers to executables that are compiled using the MINGW GCC Compiler and target the Win32 API. MSYS2 refers to executables that are compiled by MSYS2 GCC Compiler and make use of a POSIX emulation layer.
I understand as a user this can be confusing, why do you care which compiler and API Python is compiled against? Well some programs you may want to make use of, are dependent on running in a POSIX environment. It would be very hard and time consuming to port these applications to Windows. In these cases, MSYS2 provides an emulation layer to allow these applications to work. Unfortunately, making use of this emulation layer is very very slow.
So in general, if you can use the MINGW version of Python, you should because it will be much faster. But if you are trying to run a Python application that depends on being in a POSIX environment, then MSYS2 provides an emulation layer to help make it work.
For more information, the Git for Windows Wiki provides a more detailed explanation.