Pyqt5、cv2、PIL安装报错解决

一、Pyqt5报错

ERROR: Could not find a version that satisfies the requirement pyqt5 (from versions: none)
ERROR: No matching distribution found for pyqt5

在配置Pycharm时遇到此错误,主要是由于网速原因,使用下面两行代码即可下载Pyqt5 Tools和Pyqt5,注意运行顺序,先运行上面的,再运行下面的代码。

pip install pyqt5 -i https://mirrors.aliuyun.com/pypi/simple

pip install pyqt5-plugins -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

二、cv2报错

安装cv2遇到如下报错信息:

Failed to build opencv-python ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects

这是因为使用pip install opencv-python命令安装的是最新版本,python3.6不支持。所以找一个python3.6支持的版本。如opencv-python==4.3.0.38。代码如下:

pip install -i https://pypi.douban.com/simple/ pip install opencv-python==4.3.0.38

三、PIL报错

直接安装PIL包返回如下报错信息:

ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)

这是因为PIL较多用于2.7版本的Python中,到python3版本已经用Pillow代替PIL了。所以,我们应该去安装Pillow库,引入的命令方式也从:import image变为:from PIL import Image
运行命令:

pip3 install Pillow -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

你可能感兴趣的:(python,pycharm,qt)