赞
踩
环境
python 3.9.6
centos7
执行 pip3 install PyQt5==5.15.2
报错
ERROR: Could not find a version that satisfies the requirement pyqt5==5.15.4 (from versions: 5.14.0, 5.14.1, 5.14.2, 5.15.0, 5.15.1, 5.15.2, 5.15.3, 5.15.4)
ERROR: No matching distribution found for pyqt5==5.15.2
换了几个版本都在报错,于是决定用源码来安装
首先下载sip的源码进行安装,原先试过pip3 install sip,但是可能版本太高,pyqt5源码编译失败,所以使用低版本的sip
[root@eff56cf2444d /]# wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.25/sip-4.19.25.tar.gz
[root@eff56cf2444d /]# tar -xf sip-4.19.25.tar.gz
[root@eff56cf2444d /]# cd sip-4.19.25
[root@eff56cf2444d /]# python3 configure.py
[root@eff56cf2444d /]# make && make install
[root@eff56cf2444d /]# /usr/local/python3/bin/sip -V
4.19.25
接下来再安装pyqt5
[root@eff56cf2444d /]# tar -xf pyqt.tar.gz
[root@eff56cf2444d /]# cd PyQt5-5.15.2
[root@eff56cf2444d /]# python3 configure.py --qmake=/usr/bin/qmake-qt5 --sip=/usr/local/python3/bin/sip
[root@eff56cf2444d /]# make && make install # 这个过程非常久
顺利安装完成后进入python检查
[root@eff56cf2444d sip-4.19.25]# python3
Python 3.9.6 (default, Sep 15 2021, 02:35:04)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。