• 友善Nona Pi开发板ubuntu22.04系统用Python3.8.17的pip安装PyQt5.15.2时报错“Q_PID”这个宏未定义的一种解决办法


    安装命令:

    pip install PyQt5==5.15.2 --config-settings --confirm-license= --verbose -i https://mirrors.aliyun.com/pypi/simple/

    遇到出错:

    如图:

    分析具体错误内容:
     

    1. These bindings will be built: Qt, QtCore, QtNetwork, QtGui, QtWidgets, QtDBus, QtSql, QtXml, _QOpenGLFunctions_ES2, pylupdate, pyrcc.
    2. Generating the Qt bindings...
    3. _in_process.py: /tmp/pip-install-asecfkf9/pyqt5_19c1396a09f04101828420ed5f54c179/sip/QtCore/qprocess.sip: line 99: column 5: 'Q_PID' is undefined
    4. error: subprocess-exited-with-error
    5. × Preparing metadata (pyproject.toml) did not run successfully.
    6. exit code: 1
    7. ╰─> See above for output.
    8. note: This error originates from a subprocess, and is likely not a problem with pip.
    9. full command: /home/pi/anaconda3/envs/py38qt5/bin/python /home/pi/anaconda3/envs/py38qt5/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpvs7_f0g7
    10. cwd: /tmp/pip-install-asecfkf9/pyqt5_19c1396a09f04101828420ed5f54c179
    11. Preparing metadata (pyproject.toml) ... error
    12. error: metadata-generation-failed
    13. × Encountered error while generating package metadata.
    14. ╰─> See above for output.
    15. note: This is an issue with the package mentioned above, not pip.
    16. hint: See above for details.

    解决办法:打开/sip/QtCore/qprocess.sip这个文件,除过30行,删除23—32之间的行:

    我的解决办法是:
    先用WinScp进入开发板的 /tmp目录,然后执行安装命令,立即刷新此目录, 找到最新的一个以“pip-install-*”开头的子目录,然后依次进入/pyqt5_****/sip/QtCore/子目录,找到qprocess.sip,把这个文件拖到本地,修改好后,再拖到开发板中覆盖。
    如果仍然提示错误,说明你手太慢。重来一遍,手速够快的话就不报错了。

    经过漫长的等待,发现PyQt5.15.2安装成功了。
     

  • 相关阅读:
    centos7通过docker搭建nginx+php环境
    vue之浅析extend与手动挂载$mount
    网络安全(黑客)自学
    现代信号处理——其他谱估计方法(最大熵谱估计)
    CAN 通信-底层
    数仓:数仓从ETL到ELT架构的转化以及俩者的区别
    2022CCPC威海补题:A C E G J
    Centos8安装docker并配置Kali Linux图形化界面
    abc 329 e ( dfs
    2023年亚太杯数学建模亚太赛B题思路解析+代码+论文
  • 原文地址:https://blog.csdn.net/dangbochang/article/details/132921965