mac上的python-poppler-qt5安装错误

问题描述

我正在尝试安装软件包 python_poppler-qt5,但出现以下错误

pip install python-poppler-qt5

Collecting python-poppler-qt5
  Using cached python-poppler-qt5-21.1.0.tar.gz (28 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel Metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/xizg0003/opt/anaconda3/bin/python /Users/xizg0003/opt/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_Metadata_for_build_wheel /var/folders/57/f7xzdhs15v50pw097zyr8c44mxrzqx/T/tmp13hlg21d
         cwd: /private/var/folders/57/f7xzdhs15v50pw097zyr8c44mxrzqx/T/pip-install-5gvnukb2/python-poppler-qt5
    Complete output (5 lines):
    Querying qmake about your Qt installation...
    /usr/local/opt/qt/bin/qmake -query
    These bindings will be built: Poppler-Qt5.
    Generating the Poppler-Qt5 bindings...
    _in_process.py: /private/var/folders/57/f7xzdhs15v50pw097zyr8c44mxrzqx/T/pip-build-env-fkuu2mr4/overlay/lib/python3.7/site-packages/PyQt5/bindings/QtCore/QtCore.toml: 'QtCore' was built against ABI v12 but this module is being built against ABI v13
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/xizg0003/opt/anaconda3/bin/python /Users/xizg0003/opt/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_Metadata_for_build_wheel /var/folders/57/f7xzdhs15v50pw097zyr8c44mxrzqx/T/tmp13hlg21d Check the logs for full command output.

所以好像是版本冲突。你能帮我弄清楚如何解决这个问题吗?

安装环境

  • macOS Catalina v 10.15.4
  • python v 3.7.6
  • PyQt5 v 5.15.4

在卸载 Qt6 并通过自制软件安装 Qt5 后,我收到以下错误

pip install python-poppler-qt5

Collecting python-poppler-qt5
  Using cached python-poppler-qt5-21.1.0.tar.gz (28 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel Metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/xizg0003/opt/anaconda3/bin/python /Users/xizg0003/opt/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_Metadata_for_build_wheel /var/folders/57/f7xzdhs15v50pw097zyr8c44mxrzqx/T/tmpnu302c2v
         cwd: /private/var/folders/57/f7xzdhs15v50pw097zyr8c44mxrzqx/T/pip-install-_wyb5s0h/python-poppler-qt5
    Complete output (6 lines):
    Querying qmake about your Qt installation...
    /Users/xizg0003/opt/anaconda3/bin/qmake -query
    These bindings will be built: Poppler-Qt5.
    Generating the Poppler-Qt5 bindings...
    _in_process.py: poppler-form.sip:152: ::Poppler::FormFieldChoice::choicesWithExportValues() unsupported function return type - provide %MethodCode and a C++ signature
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/xizg0003/opt/anaconda3/bin/python /Users/xizg0003/opt/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_Metadata_for_build_wheel /var/folders/57/f7xzdhs15v50pw097zyr8c44mxrzqx/T/tmpnu302c2v Check the logs for full command output.

解决方法

第一个错误是由于使用了不同的 PyQt5 编译版本引起的,在这种情况下使用的是 Qt6,但 PyQt5 是使用 Qt 5.15.4 编译的。

第二个错误是因为上传到pypi的代码有bug,这种情况的解决办法是使用项目仓库中的代码,直接编译:

pip install PyQt-builder sip
git clone https://github.com/frescobaldi/python-poppler-qt5
cd python-poppler-qt5
sip-build
sip-install

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...