问题
While the current official Python version is 3.6, msys2 provides two packages for python3
:
msys/python3
, currently using 3.4mingw64/mingw-w64-x86_64-python3
, currently using 3.5
So which version should I use when and how? Can't I just use the Windows 3.6 and somehow tell pacman
to use that? Or can I get 3.6 running in a msys/mingw'd version and also use that in Windows so I don't need two/three installations?
回答1:
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
回答2:
It can be confusing why there are two versions of Python, but both serve different use cases:
- MINGW - Windows native applications
- MSYS2 - POSIX applications emulated to work in Windows
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.
来源:https://stackoverflow.com/questions/41932407/which-python-should-i-install-and-how-when-using-msys2