友善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/

遇到出错:

如图:

分析具体错误内容:
 

  These bindings will be built: Qt, QtCore, QtNetwork, QtGui, QtWidgets, QtDBus, QtSql, QtXml, _QOpenGLFunctions_ES2, pylupdate, pyrcc.
  Generating the Qt bindings...
  _in_process.py: /tmp/pip-install-asecfkf9/pyqt5_19c1396a09f04101828420ed5f54c179/sip/QtCore/qprocess.sip: line 99: column 5: 'Q_PID' is undefined
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  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
  cwd: /tmp/pip-install-asecfkf9/pyqt5_19c1396a09f04101828420ed5f54c179
  Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

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

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

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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值