gpt4 book ai didi

python - 无法加载库 : cairo

转载 作者:太空宇宙 更新时间:2023-11-04 11:17:30 25 4
gpt4 key购买 nike

我在尝试运行以下命令时不断收到此错误:

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

错误:

  raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2

我使用 pip install weasyprint 安装了 Weasyprint。为了安装 cairo,我使用了这个文档:https://weasyprint.readthedocs.io/en/latest/install.html

但是,在本指南的最后,当我尝试运行 WHERE libcairo-2.dll 时,我收到了一个not found 错误。

我一直在逐步按照指南进行操作,但它不起作用,而且我不断收到相同的错误,我搜索了各种解决方案,但没有一个能解决问题。有什么建议吗?提前致谢

最佳答案

您还需要安装 GTK+ 库(不仅仅是 weasyprint),以便 weasyprint 呈现最终的 PDF。

您可以找到适用于您的操作系统的安装说明 documented on weasyprint's website .

Dear Windows user, please follow these steps carefully.

Really carefully. Don’t cheat.

Besides a proper Python installation and a few Python packages, WeasyPrint needs the Pango, cairo and GDK-PixBuf libraries. They are required for the graphical stuff: Text and image rendering. These libraries aren’t Python packages. They are part of GTK+ (formerly known as GIMP Toolkit), and must be installed separately.

如果您运行的是 64 位版本的 Windows,您可以从 here 获取 GTK 安装程序。 .一旦你安装了......然后运行

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

应该按预期工作。

关于python - 无法加载库 : cairo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56704202/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com