python-poppler-qt5 安装错误 mac

python-poppler-qt5 installation error on mac

我正在尝试安装软件包 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.

看来是版本冲突了。你能帮我弄清楚如何解决这个问题吗?

安装环境

卸载 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