| 1 |
.. _dev-building-on-windows: |
| 2 |
|
| 3 |
|
| 4 |
Preparing Windows build environment |
| 5 |
=================================== |
| 6 |
|
| 7 |
To start developing PyWavelets code on Windows you will have to install |
| 8 |
a C compiler and prepare the build environment. |
| 9 |
|
| 10 |
Installing Windows SDK C/C++ compiler |
| 11 |
------------------------------------- |
| 12 |
|
| 13 |
Depending on your Python version, a different version of the Microsoft Visual |
| 14 |
C++ compiler will be required to build extensions. The same compiler that was |
| 15 |
used to build Python itself should be used. |
| 16 |
|
| 17 |
For Python 3.7 or 3.8 it will be MSVC 2015. |
| 18 |
|
| 19 |
The MSVC version should be printed when starting a Python REPL, and can be |
| 20 |
checked against the note below: |
| 21 |
|
| 22 |
.. note:: For reference: |
| 23 |
|
| 24 |
- the *MSC v.1500* in the Python version string is Microsoft Visual |
| 25 |
C++ 2008 (Microsoft Visual Studio 9.0 with msvcr90.dll runtime) |
| 26 |
- *MSC v.1600* is MSVC 2010 (10.0 with msvcr100.dll runtime) |
| 27 |
- *MSC v.1700* is MSVC 2012 (11.0) |
| 28 |
- *MSC v.1800* is MSVC 2013 (12.0) |
| 29 |
- *MSC v.1900* is MSVC 2015 (14.0) |
| 30 |
|
| 31 |
:: |
| 32 |
|
| 33 |
Python 3.5.5 (default, Feb 13 2018, 06:15:35) [MSC v.1900 64 bit (AMD64)] on win32 |
| 34 |
|
| 35 |
To get started first download, extract and install *Microsoft Windows SDK for |
| 36 |
Windows 7 and .NET Framework 3.5 SP1* from |
| 37 |
http://www.microsoft.com/downloads/en/details.aspx?familyid=71DEB800-C591-4F97-A900-BEA146E4FAE1&displaylang=en. |
| 38 |
|
| 39 |
There are several ISO images on the site, so just grab the one that is suitable |
| 40 |
for your platform: |
| 41 |
|
| 42 |
- ``GRMSDK_EN_DVD.iso`` for 32-bit x86 platform |
| 43 |
- ``GRMSDKX_EN_DVD.iso`` for 64-bit AMD64 platform (AMD64 is the codename for |
| 44 |
64-bit CPU architecture, not the processor manufacturer) |
| 45 |
|
| 46 |
After installing the SDK and before compiling the extension you have |
| 47 |
to configure some environment variables. |
| 48 |
|
| 49 |
For 32-bit build execute the ``util/setenv_build32.bat`` script in the cmd |
| 50 |
window: |
| 51 |
|
| 52 |
.. sourcecode:: bat |
| 53 |
|
| 54 |
rem Configure the environment for 32-bit builds. |
| 55 |
rem Use "vcvars32.bat" for a 32-bit build. |
| 56 |
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat" |
| 57 |
rem Convince setup.py to use the SDK tools. |
| 58 |
set MSSdk=1 |
| 59 |
setenv /x86 /release |
| 60 |
set DISTUTILS_USE_SDK=1 |
| 61 |
|
| 62 |
For 64-bit use ``util/setenv_build64.bat``: |
| 63 |
|
| 64 |
.. sourcecode:: bat |
| 65 |
|
| 66 |
rem Configure the environment for 64-bit builds. |
| 67 |
rem Use "vcvars32.bat" for a 32-bit build. |
| 68 |
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" |
| 69 |
rem Convince setup.py to use the SDK tools. |
| 70 |
set MSSdk=1 |
| 71 |
setenv /x64 /release |
| 72 |
set DISTUTILS_USE_SDK=1 |
| 73 |
|
| 74 |
See also http://wiki.cython.org/64BitCythonExtensionsOnWindows. |
| 75 |
|
| 76 |
MinGW C/C++ compiler |
| 77 |
-------------------- |
| 78 |
|
| 79 |
MinGW distribution can be downloaded from |
| 80 |
http://sourceforge.net/projects/mingwbuilds/. |
| 81 |
|
| 82 |
In order to change the settings and use MinGW as the default compiler, |
| 83 |
edit or create a Distutils configuration file |
| 84 |
``c:\Python2*\Lib\distutils\distutils.cfg`` and place the following |
| 85 |
entry in it:: |
| 86 |
|
| 87 |
[build] |
| 88 |
compiler = mingw32 |
| 89 |
|
| 90 |
You can also take a look at Cython's "Installing MinGW on Windows" |
| 91 |
page at http://wiki.cython.org/InstallingOnWindows for more info. |
| 92 |
|
| 93 |
|
| 94 |
.. note:: |
| 95 |
|
| 96 |
Python 2.7/3.2 distutils package is incompatible with the current version |
| 97 |
(4.7+) of MinGW (MinGW dropped the ``-mno-cygwin`` flag, which is still |
| 98 |
passed by distutils). |
| 99 |
|
| 100 |
To use MinGW to compile Python extensions you have to patch the |
| 101 |
``distutils/cygwinccompiler.py`` library module and remove every occurrence |
| 102 |
of ``-mno-cygwin``. |
| 103 |
|
| 104 |
See http://bugs.python.org/issue12641 bug report for more information |
| 105 |
on the issue. |
| 106 |
|
| 107 |
|
| 108 |
Next steps |
| 109 |
---------- |
| 110 |
|
| 111 |
After completing these steps continue with |
| 112 |
:ref:`Installing build dependencies <dev-installing-build-dependencies>`. |
| 113 |
|
| 114 |
|
| 115 |
.. _Python: http://python.org/ |
| 116 |
.. _numpy: http://numpy.org/ |
| 117 |
.. _Cython: http://cython.org/ |
| 118 |
.. _Sphinx: http://sphinx.pocoo.org/ |
| 119 |
.. _MinGW C compiler: http://sourceforge.net/projects/mingwbuilds/ |