If you e.g. would like to have a debug version of matplotlib (which is not possible to install through pip) you need to compile matplotlib from source. It is somewhat tricky but can be done like this:
-
Install Visual Studio 2017 with Visual C++ and Windows SDK from https://visualstudio.microsoft.com/downloads/
-
Install Python 3.7 from https://www.python.org/
-
Download matplotlib source from https://github.com/matplotlib/matplotlib/tree/v3.1.1 and extract to
matplotlib -
Download freetype source from https://download.savannah.gnu.org/releases/freetype/ and extract to
freetype-2.10.0- Open
freetype-2.10.0\builds\windows\vc2010\freetype.slnin Visual Studio 2017 - Select target x64
- Right click on the freetype project and select properties
- Set Configuration type to Static library (.lib)
- Build
- Copy
objs\freetype.libtomatplotlib\freetype.lib
- Open
-
Download zlib soruce from https://zlib.net/ and extract to
zlib -
Compile zlib
-
Open VS 2017 console in folder
zlib -
Run command
nmake -f win32\Makefile.msc -
Copy
zlib\zlib.libtomatplotlib\z.lib(note z.lib, not zlib.lib)
-
-
Download libpng source from http://www.libpng.org/pub/png/libpng.html and extract to
lpng1637 -
Compile libpng
-
Open VS 2017 console in folder
lpng1637 -
Run command
nmake -f scripts\makefile.vcwin32 -
Copy
lpng1647/libpng.libtomatplotlib/png.lib
-
-
Create a batch file with contents:
build-matplotlib.batcall "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64 SET INCLUDE=C:\Python37\SOURCE\freetype-2.10.0\include;%INCLUDE% SET INCLUDE=C:\Python37\SOURCE\zlib;%INCLUDE% SET INCLUDE=C:\Python37\SOURCE\lpng1637;%INCLUDE% cd matplotlib c:\Python37\python_d.exe setup.py build --debug install pause
(assuming that you installed Python37 in
C:\Python37and put all code inC:\Python37\SOURCE) -
Run the batch file to build matplotlib