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

posted @   Mello  阅读(3334)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示