In order to start generating documents with Weasyprint I installed it on my Windows machine following these instructions:
https://weasyprint.readthedocs.io/en/stable/install.html#step-5-run-weasyprint
On my computer it works but I have a Django project where I want to integrate this library and I use pipenv.
How to install the necessary libraries even in the virtual environment?
I tried setting the path for the pycairo package into the Pipfile like
pycairo= {path= "C:/Program Files/GTK3-Runtime Win64/bin/"}
but still it throws the error:
OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2
I have 64bit Windows machine and this is the Pipfile:
[[source]] name = "pypi" url = "https://pypi.org/simple" verify_ssl = true [dev-packages] pylint = "*" [packages] django = "*" mysql = "*" ipython = "*" django-webpack = "*" django-webpack-loader = "*" django-livereload-server = "*" pylint = "*" reportlab = "*" weasyprint = "*" django-weasyprint = "*" pycairo= {path= "C:/Program Files/GTK3-Runtime Win64/bin/"} cairocffi = "*" [requires] python_version = "3.7"
Advertisement
Answer
You need install ‘GTK+ 64 Bit Installer’ path in this local:
C:msys2
Source: WeasyPrint Github