Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 839
Mhmoud Amsha Avatar asked Dec 25 '19 19:12

Mhmoud Amsha


2 Answers

Installing GTK+ didn't work for me. I solved this problem using UniConverter2.0. My environments is

  • Python 3.7
  • Windows 10 x64
  1. Install uniconvertor-2.0rc4-win64_headless.msi,
  2. Find the "dll" sub-directory under the UniConverter installation path.(In my case, C:\Program Files\UniConvertor-2.0rc4\dlls)
  3. Add this "dll" path to the system path.
  4. Close VSCode and reopen the project.
  5. Try to run the server again. Enjoy!
like image 51
Green Tree Avatar answered Sep 19 '22 06:09

Green Tree


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
like image 25
Srijwal R Avatar answered Sep 21 '22 06:09

Srijwal R