赞
踩
解决方案尝试
先安装pyqt5依赖项:
1、更新python3.7
sudo add-apt-repository ppadeadsnakes/ppa
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2sudo update-alternatives --config python3
sudo apt-get install python3.7-dev
sudo apt-get install libhdf5-dev
2、更新 pip3Q:
sudo python3 -m pip install --upgrade pip
3、安装pyqt5Q的依赖项
sudo apt install pygt5
sudo apt install gt5-default gttools5-dev-tools
4、最后再安装pyqt5
sudo pip3 install pyqt5sudo pip3 install pygt5-tools
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple PyQt5
注意:当pyqt5安装OK,执行文件编辑报错时,例如下错:recent call last):
File "VideoTest.py", line 12, in <module>
from PyQt5.QtWidgets import QHBoxLayout
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/local/lib/python3.7/dist-packages/PyQt5/QtWidgets.abi3.so)
可能是版本不兼容的问题,可先通过:
要查看当前安装的PyQt5版本,您可以使用以下命令:
pip3 show PyQt5
再通过:使用软件包管理器(对于Linux系统)
apt-cache policy python3-pyqt5
将Pyqt5的版本包与python3-pyqt5一致即可解决问题,
执行的指令:
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple PyQt5==<compatible_version>
<compatible_version>:当前版本信息
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。