Installing WeasyPrint on Windows
WeasyPrint converts HTML including images to PDF, it's cross platformbut Windows requires a decent amount of massaging to persuade it to work.
![Pycairo Pycairo](/uploads/1/2/6/5/126584307/929415077.png)
To install Pango and Cairo download the all in one bundleof the GTK+ stack and extract the archive to C:GTK.
Pycairo Install Windows 10
To install PyCairo in your home directory you need to first install it's dependancies, Pixman and Cairo. To do that, you can use our Install Software From Source guide. I've managed to install it in a test user's home like that: Open an SSH session to the server. If you don't know how this guide will help you. It supports Linux, Windows and macOS and works with Python 2.7+, Python 3.5+, PyPy and PyPy3. PyGObject, including this documentation, is licensed under the LGPLv2.1+. If you want to write a Python application for GNOME or a Python GUI application using GTK, then PyGObject is the way to go. Pycairo, including this documentation, is licensed under the LGPLv2.1 as well as the MPLv1.1. The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in a more ‘Pythonic’ way. Pip install pycairo. The python modules pygobject, pycairo and pygtk under Windows OS. I used the python version 2.7 32 bits under. C: Python27python. Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) MSC v.1500 32 bit (. Intel) on win32. Type 'help', 'copyright', 'credits' or 'license' for more information.
You'll need to add the GTK bin folder to your system path so the variouslibraries can be found when requested by WeasyPrint, to do thatgo to the 'System' in the Control Panel, then open 'Advanced SystemSettings' then 'Environment Variables' and edit the System variable calledPath by adding ;c:gtk to the end of the current value.
![Anaconda install pycairo windows Anaconda install pycairo windows](/uploads/1/2/6/5/126584307/700435361.jpeg)
With that out of the way, we need to install a few Python libraries thatWeasyPrint uses to interface with the GTK stack. The easiest way is fromprecompiled binaries, so head over to Christoph Gohkle's Python Packagesand download and install Py2Cairo, PyGObject and PyGTK for your version ofPython (I've tested with 32bit 2.7). You'll also need to install thelxml package he provides.
Pip Install Pycairo
Now you should be able to just pip install WeasyPrint