gpt4 book ai didi

python-3.x - python pyinstaller 未找到名为 "cairo"的库

转载 作者:行者123 更新时间:2023-12-03 11:06:21 38 4
gpt4 key购买 nike

编译依赖于 matplotlib 的应用程序时和 pyside2pyinstaller我收到这些错误

环境

 PyInstaller: 3.5
Python: 3.7.5
Platform: Windows-10-10.0.14393-SP0

错误
    31256 INFO:   Matplotlib backend GTK3Agg: ignored
Traceback (most recent call last):
File c:\users\digikwondo\pycharmprojects\guitest\venv\lib\site-
packages\matplotlib\backends\backend_cairo.py, line 14, in <module>
import cairo
ModuleNotFoundError: No module named cairo

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<string>", line 12, in <module>
File "c:\users\digikwondo\pycharmprojects\guitest\venv\lib\site-
packages\matplotlib\backends\backend_gtk3agg.py, line 4, in <module>
from . import backend_agg, backend_cairo, backend_gtk3
File "c:\users\digikwondo\pycharmprojects\guitest\venv\lib\site-
packages\matplotlib\backends\backend_cairo.py", line 20, in <module>
import cairocffi as cairo
File "c:\users\digikwondo\pycharmprojects\guitest\venv\lib\site-packages\cairocffi\__init__.py", line 50, in <module>
('libcairo.so', 'libcairo.2.dylib', 'libcairo-2.dll'))
File "c:\users\digikwondo\pycharmprojects\guitest\venv\lib\site-packages\cairocffi\__init__.py", line 45, in dlopen
raise OSError(error_message) # pragma: no cover
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 0x7e
cannot load library 'libcairo-2.dll': error 0x7e

我的导入语句
from PySide2.QtWidgets import (QApplication, QLabel, QPushButton, QMessageBox, QWidget, QLineEdit, QTextBrowser, QListWidget, QFileDialog, QTabWidget, QGridLayout) 
from PySide2.QtCore import (Slot, QRect, QFile, QTextStream)
from PySide2.QtGui import (QIcon, QFont)
from zipfile import (ZipFile)
from pandas.io.common import EmptyDataError
import glob
import sys
import os
import time
import pandas
import logging
import webbrowser
from pathlib import Path
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator as mxl
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()

安装的pip包
altgraph          0.16.1
arrow 0.15.4
attrs 19.3.0
cairocffi 1.1.0
certifi 2019.9.11
cffi 1.13.2
chardet 3.0.4
Click 7.0
cycler 0.10.0
future 0.18.2
joblib 0.14.0
kiwisolver 1.1.0
llvmlite 0.30.0
matplotlib 3.1.1
Nuitka 0.6.5
numba 0.45.1
numpy 1.17.4
packaging 19.1
pandas 0.25.1
pefile 2019.4.18
pip 19.0.3
pip-review 1.0
pip-tools 4.1.0
pycparser 2.19
PyInstaller 3.5
pyparsing 2.4.2
pypiwin32 223
PyQt5 5.13.0
PyQt5-sip 4.19.19
pyqt5-tools 5.13.0.1.5
PySide2 5.13.1
python-dateutil 2.8.1
python-dotenv 0.10.3
pytz 2019.2
pywin32 225
pywin32-ctypes 0.2.0
scikit-learn 0.21.3
scipy 1.3.1
setuptools 41.2.0
setuptools-freeze 0.0.1
shiboken2 5.13.1
sip 4.19.8
six 1.13.0
tornado 6.0.3
umap 0.1.1
umap-learn 0.3.10

我不确定当 pyinstaller 完成并且我的应用程序运行没有问题时会产生什么影响。
希望得到一些帮助来理解这些错误以及如何解决它们

最佳答案

在 Windows 上,在 cairocffi 之上你需要从 here 安装 Gtk++并确保图书馆libcairo-2.dll在系统上可用 PATH .

关于python-3.x - python pyinstaller 未找到名为 "cairo"的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58936632/

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