PyQt5在导入skimage时有问题

时间:2017-12-04 19:36:39

标签: python anaconda pyqt5 scikit-image

我正在使用Skimage处理RGB颜色操作的图像,并且具有以下配置包:

Python 3.6.1

scikit-image 0.13.0

pyqt 5.6.0

from skimage import io

import sip
sip.setapi('QString', 2)
from PyQt5 import QtGui

io.use_plugin('pil','imread')

img=io.imread('RpMkYUX.jpg')
io.use_plugin('qt' ,'imshow')
io.imshow(img)
io.show()

期望输出如图像

预期产出

我的错误如下:

(C:\Users\rahul\Anaconda3) C:\Users\rahul\AnacondaProjects\15_PIL>python 2_.py
Traceback (most recent call last):
  File "C:\Users\rahul\Anaconda3\lib\site-packages\skimage\io\_plugins\qt_plugin.py", line 11, in <module>
    from PyQt4.QtGui import (QApplication, QImage,
ModuleNotFoundError: No module named 'PyQt4'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "2_.py", line 16, in <module>
    io.use_plugin('qt' ,'imshow')
  File "C:\Users\rahul\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 255, in use_plugin
    _load(name)
  File "C:\Users\rahul\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 299, in _load
    fromlist=[modname])
  File "C:\Users\rahul\Anaconda3\lib\site-packages\skimage\io\_plugins\qt_plugin.py", line 28, in <module>
    """)
ImportError:     PyQt4 libraries not installed. Please refer to

    http://www.riverbankcomputing.co.uk/software/pyqt/intro

    for more information.  PyQt4 is GPL licensed.  For an
    LGPL equivalent, see

    http://www.pyside.org

1 个答案:

答案 0 :(得分:0)

我使用的是pip 19.1.1和Python 3.7.4

D:\tesF> python scikit-image-tes.py
Traceback (most recent call last):
  File "scikit-image-tes.py", line 10, in <module>
    io.use_plugin('qt' ,'imshow')
  File "C:\Users\pcname\AppData\Roaming\Python\Python37\site-packages\skimage\io\manage_plugins.py", line 254, in use_plugin
    _load(name)
  File "C:\Users\pcname\AppData\Roaming\Python\Python37\site-packages\skimage\io\manage_plugins.py", line 298, in _load
    fromlist=[modname])
  File "C:\Users\pcname\AppData\Roaming\Python\Python37\site-packages\skimage\io\_plugins\qt_plugin.py", line 5, in <module>
    from qtpy.QtWidgets import (QApplication, QLabel, QMainWindow, QWidget,
ModuleNotFoundError: No module named 'qtpy'

在我出错之前

解决者:

D:\tesF> pip install sip
D:\tesF> pip install qtpy

在此之前,我已经安装

D:\tesF> pip install PyQt5