Django:OSError: cannot load library 'gobject-2.0-0': error 0x7e.


報錯提示

錯誤診斷

django項目中的WeasyPrint模塊引用了Cairocffi模塊,以實現命令行操作html功能,但是Cairocffi需要使用gobject模塊,在Windows下gobject還需要安裝一堆dll,也就是dll地獄。

處理方式

import os

os.add_dll_directory(r"C:\Program Files\GTK3-Runtime Win64\bin")

參考

GitHub weasyprint issues:https://github.com/Kozea/WeasyPrint/issues/589
stackoverflow:https://stackoverflow.com/questions/63449770/oserror-cannot-load-library-gobject-2-0-error-0x7e


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM