Search code examples
pythonwindowspipcairopycairo

django OSError: no library called "cairo" was found on windows


When I run the Django server, I see this problem !!

OSError: no library called "cairo" was found

no library called "libcairo-2" was found

cannot load library 'libcairo.so': error 0x7e

cannot load library 'libcairo.2.dylib': error 0x

cannot load library 'libcairo-2.dll': error 0x7e

Solution

  • WeasyPrint needs the Pango, cairo and GDK-PixBuf libraries. They are part of GTK+ (formerly known as GIMP Toolkit), and must be installed separately.

    After installing GTK+ libraries, do :

    python -m weasyprint http://weasyprint.org weasyprint.pdf