python Python 3.9.13 (tags/v-6ren">
gpt4 book ai didi

python - 操作系统错误 : no library called "cairo-2" was found (from Custom_Widgets import ProjectMaker)

转载 作者:行者123 更新时间:2023-12-02 01:29:34 25 4
gpt4 key购买 nike

如何修复这个错误?

C:\Users\vanvl\OneDrive\Bureaublad\Progammeren\Project 1.02.2>python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from Custom_Widgets import ProjectMaker
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\vanvl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\Custom_Widgets\ProjectMaker.py", line 14, in <module>
import cairosvg
File "C:\Users\vanvl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cairosvg\__init__.py", line 26, in <module>
from . import surface # noqa isort:skip
File "C:\Users\vanvl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cairosvg\surface.py", line 9, in <module>
import cairocffi as cairo
File "C:\Users\vanvl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cairocffi\__init__.py", line 48, in <module>
cairo = dlopen(
File "C:\Users\vanvl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cairocffi\__init__.py", line 45, in dlopen
raise OSError(error_message) # pragma: no cover
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': error 0x7e
cannot load library 'libcairo.2.dylib': error 0x7e
cannot load library 'libcairo-2.dll': error 0x7e

最佳答案

这是一个非常恼人的依赖性问题,因为 cairocffi 不是为 Windows 构建的,您需要额外的依赖性,如此处所述:https://cairocffi.readthedocs.io/en/stable/overview.html#installing-cairo-on-windows

更快的解决方案是执行以下操作:我使用了从非官方存储库安装的 pipwin https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo

pip install pipwin

pipwin install cairocffi

另请参阅此相关问题:get cairosvg working in windows

关于python - 操作系统错误 : no library called "cairo-2" was found (from Custom_Widgets import ProjectMaker),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73637315/

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