基于龙芯loongnix20系统安装PyQtWebEngine==5.15.5

  目前项目需求,需要这个包做开发,很遗憾,这个包在Loongnix-20.3(Loongnix-20.3.livecd.cartoon.loongarch64)系统上无法直接pip3 install 安装,安装报错:

loongson@debian:~$ pip3 install PyQtWebEngine==5.15.5
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.loongnix.cn/loongson/pypi, https://pypi.tuna.tsinghua.edu.cn/simple
Collecting PyQtWebEngine==5.15.5
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/60/66/56e118abb4cddd8e4bea6f89bdec834069b52479fb991748f1b21950811e/PyQtWebEngine-5.15.5.tar.gz (48 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      Querying qmake about your Qt installation...
      These bindings will be built: QtWebEngineCore, QtWebEngine, QtWebEngineWidgets.
      Generating the QtWebEngineCore bindings...
      _in_process.py: /tmp/pip-install-zxnzl46f/pyqtwebengine_bb67808b424f4ed2b51cae0db5b2262e/sip/QtWebEngineCore/QtWebEngineCoremod.sip: line 25: column 9: 'QtCore/QtCoremod.sip' could not be found
      /tmp/pip-install-zxnzl46f/pyqtwebengine_bb67808b424f4ed2b51cae0db5b2262e/sip/QtWebEngineCore/QtWebEngineCoremod.sip: line 26: column 9: 'QtGui/QtGuimod.sip' could not be found
      /tmp/pip-install-zxnzl46f/pyqtwebengine_bb67808b424f4ed2b51cae0db5b2262e/sip/QtWebEngineCore/QtWebEngineCoremod.sip: line 27: column 9: 'QtNetwork/QtNetworkmod.sip' could not be found
      /tmp/pip-install-zxnzl46f/pyqtwebengine_bb67808b424f4ed2b51cae0db5b2262e/sip/QtWebEngineCore/qwebengineclientcertificatestore.sip: line 24: column 6: 'PyQt_SSL' is not a known qualifier
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
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.

  尝试手动编译:

  下载安装包:PyQtWebEngine-5.15.5.tar.gz解压之后,进行配置:

sudo python3 configure.py --verbose

2023-02-10补充

问题:

loongson@loongson-pc:~/PyQtWebEngine-5.15.5# python3 configure.py 
Error: Make sure you have a working sip on your PATH or use the --sip argument
to explicitly specify a working sip.

解决方式:

sudo apt-get install pyqt5*

loongson@loongson-pc:~/temp/PyQtWebEngine-5.15.5$ python3 configure.py --verbose
Configuring PyQtWebEngine 5.15.5...
The PyQtWebEngine .sip files will be installed in /usr/share/sip/PyQt5.
PyQtWebEngine will be installed in /usr/lib/python3/dist-packages/PyQt5.
PyQt 5.11.3 is being used.
Qt 5.15.2 is being used.
sip 4.19.14 is being used.
The sip executable is /usr/bin/sip.
PyQtWebEngine is being built with 'protected' redefined as 'public'.
The PEP 484 stubs will be installed in /usr/lib/python3/dist-packages/PyQt5.
The QScintilla API file will be installed in /usr/share/qt5/qsci/api/python.
Generating the C++ source for the QtWebEngine module...
/usr/bin/sip -I /home/loongson/temp/PyQtWebEngine-5.15.5/sip -I /usr/share/sip/PyQt5 -n sip -t WS_X11 -t Qt_5_15_2 -B Qt_6_0_0 -t QtWebEngine_5_15_0 -y QtWebEngine.pyi -a QtWebEngine.api -P -o -c /home/loongson/temp/PyQtWebEngine-5.15.5/QtWebEngine /home/loongson/temp/PyQtWebEngine-5.15.5/sip/QtWebEngine/QtWebEnginemod.sip
Generating the .pro file for the QtWebEngine module...
Generating the C++ source for the QtWebEngineCore module...
/usr/bin/sip -I /home/loongson/temp/PyQtWebEngine-5.15.5/sip -I /usr/share/sip/PyQt5 -n sip -t WS_X11 -t Qt_5_15_2 -B Qt_6_0_0 -t QtWebEngine_5_15_0 -y QtWebEngineCore.pyi -a QtWebEngineCore.api -P -o -c /home/loongson/temp/PyQtWebEngine-5.15.5/QtWebEngineCore /home/loongson/temp/PyQtWebEngine-5.15.5/sip/QtWebEngineCore/QtWebEngineCoremod.sip
Generating the .pro file for the QtWebEngineCore module...
Generating the C++ source for the QtWebEngineWidgets module...
/usr/bin/sip -I /home/loongson/temp/PyQtWebEngine-5.15.5/sip -I /usr/share/sip/PyQt5 -n sip -t WS_X11 -t Qt_5_15_2 -B Qt_6_0_0 -t QtWebEngine_5_15_0 -y QtWebEngineWidgets.pyi -a QtWebEngineWidgets.api -P -o -c /home/loongson/temp/PyQtWebEngine-5.15.5/QtWebEngineWidgets /home/loongson/temp/PyQtWebEngine-5.15.5/sip/QtWebEngineWidgets/QtWebEngineWidgetsmod.sip
sip: /home/loongson/temp/PyQtWebEngine-5.15.5/sip/QtWebEngineWidgets/QtWebEngineWidgetsmod.sip:57: No such platform or feature
Error: Unable to create the C++ code.

报错点,缺少QtWebChannelmod.sip:

%If (PyQt_WebChannel)
%Import QtWebChannel/QtWebChannelmod.sip
%End

解决方式:

cp -rf  /usr/share/sip/PyQt5/*  sip/

继续:

loongson@loongson-pc:~/PyQtWebEngine-5.15.5$ sudo python3 configure.py --verbose
[sudo] loongson 的密码:
Configuring PyQtWebEngine 5.15.5...
The PyQtWebEngine .sip files will be installed in /usr/share/sip/PyQt5.
PyQtWebEngine will be installed in /usr/lib/python3/dist-packages/PyQt5.
PyQt 5.11.3 is being used.
Qt 5.15.2 is being used.
sip 4.19.14 is being used.
The sip executable is /usr/bin/sip.
PyQtWebEngine is being built with 'protected' redefined as 'public'.
The PEP 484 stubs will be installed in /usr/lib/python3/dist-packages/PyQt5.
The QScintilla API file will be installed in /usr/share/qt5/qsci/api/python.
Generating the C++ source for the QtWebEngine module...
/usr/bin/sip -I /home/loongson/PyQtWebEngine-5.15.5/sip -I /usr/share/sip/PyQt5 -n sip -t WS_X11 -t Qt_5_15_2 -B Qt_6_0_0 -t QtWebEngine_5_15_0 -y QtWebEngine.pyi -a QtWebEngine.api -P -o -c /home/loongson/PyQtWebEngine-5.15.5/QtWebEngine /home/loongson/PyQtWebEngine-5.15.5/sip/QtWebEngine/QtWebEnginemod.sip
Generating the .pro file for the QtWebEngine module...
Generating the C++ source for the QtWebEngineCore module...
/usr/bin/sip -I /home/loongson/PyQtWebEngine-5.15.5/sip -I /usr/share/sip/PyQt5 -n sip -t WS_X11 -t Qt_5_15_2 -B Qt_6_0_0 -t QtWebEngine_5_15_0 -y QtWebEngineCore.pyi -a QtWebEngineCore.api -P -o -c /home/loongson/PyQtWebEngine-5.15.5/QtWebEngineCore /home/loongson/PyQtWebEngine-5.15.5/sip/QtWebEngineCore/QtWebEngineCoremod.sip
Generating the .pro file for the QtWebEngineCore module...
Generating the C++ source for the QtWebEngineWidgets module...
/usr/bin/sip -I /home/loongson/PyQtWebEngine-5.15.5/sip -I /usr/share/sip/PyQt5 -n sip -t WS_X11 -t Qt_5_15_2 -B Qt_6_0_0 -t QtWebEngine_5_15_0 -y QtWebEngineWidgets.pyi -a QtWebEngineWidgets.api -P -o -c /home/loongson/PyQtWebEngine-5.15.5/QtWebEngineWidgets /home/loongson/PyQtWebEngine-5.15.5/sip/QtWebEngineWidgets/QtWebEngineWidgetsmod.sip
Generating the .pro file for the QtWebEngineWidgets module...
Generating the QScintilla API file...
Generating the top-level .pro file...
Generating the Makefiles...
/usr/bin/qmake -recursive PyQtWebEngine.pro
Reading /home/loongson/PyQtWebEngine-5.15.5/QtWebEngine/QtWebEngine.pro
Project ERROR: Unknown module(s) in QT: webengine
Error: /usr/bin/qmake failed to create a Makefile from PyQtWebEngine.pro.

解决方式:

sudo apt install qtwebengine5-dev

再继续:

loongson@loongson-pc:~/temp/PyQtWebEngine-5.15.5$ sudo python3 configure.py 
Configuring PyQtWebEngine 5.15.5...
The PyQtWebEngine .sip files will be installed in /usr/share/sip/PyQt5.
PyQtWebEngine will be installed in /usr/lib/python3/dist-packages/PyQt5.
PyQt 5.11.3 is being used.
Qt 5.15.2 is being used.
sip 4.19.14 is being used.
The sip executable is /usr/bin/sip.
PyQtWebEngine is being built with 'protected' redefined as 'public'.
The PEP 484 stubs will be installed in /usr/lib/python3/dist-packages/PyQt5.
The QScintilla API file will be installed in /usr/share/qt5/qsci/api/python.
Generating the C++ source for the QtWebEngine module...
Generating the .pro file for the QtWebEngine module...
Generating the C++ source for the QtWebEngineCore module...
Generating the .pro file for the QtWebEngineCore module...
Generating the C++ source for the QtWebEngineWidgets module...
Generating the .pro file for the QtWebEngineWidgets module...
Generating the QScintilla API file...
Generating the top-level .pro file...
Generating the Makefiles...

接下来进行编译(20221208更新,此步骤可能会出现问题,见文章最后的问题1):

sudo make
loongson@loongson-pc:~/temp/PyQtWebEngine-5.15.5$ sudo make
cd QtWebEngine/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /home/loongson/temp/PyQtWebEngine-5.15.5/QtWebEngine/QtWebEngine.pro ) && make -f Makefile 
make[1]: 进入目录“/home/loongson/temp/PyQtWebEngine-5.15.5/QtWebEngine”
g++ -c -pipe -fno-exceptions -O2 -Wall -Wextra -D_REENTRANT -fPIC 
...
ibQt5Widgets.so /usr/lib/loongarch64-linux-gnu/libQt5Gui.so /usr/lib/loongarch64-linux-gnu/libQt5QmlModels.so /usr/lib/loongarch64-linux-gnu/libQt5WebChannel.so /usr/lib/loongarch64-linux-gnu/libQt5Qml.so /usr/lib/loongarch64-linux-gnu/libQt5Network.so /usr/lib/loongarch64-linux-gnu/libQt5Positioning.so /usr/lib/loongarch64-linux-gnu/libQt5Core.so -lGL -lpthread    
cp -f libQtWebEngineWidgets.so QtWebEngineWidgets.so
make[1]: 离开目录“/home/loongson/temp/PyQtWebEngine-5.15.5/QtWebEngineWidgets”

接下来安装:

sudo make install

安装成功之后进行核查:

pip3 list

在这里插入图片描述
over!

后记:
以上情况基于一个前提环境:Linux debian安装PyCharm教程、配置pyqt5开发环境

其中以下命令执行失败:

sudo apt-get install qttools5-dev-tools

可借助以下指令安装:

sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
sudo apt-get install qtcreator

问题1:
Loongnix-20.2系统上出现以下问题:
在这里插入图片描述这个问题是下面这一步导致的,系统包存在差异:

cp -rf  /usr/share/sip/PyQt5/*  sip/

借用Loongnix-20.3系统下的/usr/share/sip/PyQt5/*这些文件直接编即可。这里我附上一个已经编译通过的包。PyQtWebEngine-5.15.5
下载之后需要再执行python3 configure.py ——> make ——>sudo make install即可

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值