Import error No module named skimage

泪湿孤枕 提交于 2019-11-29 10:42:14

问题


I am building code on python using skimage. But I am getting import errors while using skimage.segmentation.

Traceback (most recent call last):

File "superpixel.py", line 5, in

from skimage.segmentation import slic

ImportError: No module named skimage.segmentation


回答1:


You can use pip install scikit-image.

Also see the recommended procedure.




回答2:


As per the official installation page of skimage (skimage Installation) : python-skimage package depends on matplotlib, scipy, pil, numpy and six.

So install them first using

sudo apt-get install python-matplotlib python-numpy python-pil python-scipy

Apparently skimage is a part of Cython which in turn is a superset of python and hence you need to install Cython to be able to use skimage.

sudo apt-get install build-essential cython

Now install skimage package using

sudo apt-get install python-skimage

This solved the Import error for me.




回答3:


For OSX: pip install scikit-image

and then run python to try following

from skimage.feature import corner_harris, corner_peaks



回答4:


For Python 3, try the following:

import sys
!conda install --yes --prefix {sys.prefix} scikit-image



回答5:


For python 3.5 in case you have multiple python versions and want to install with python3.5:

pip3 install scikit-image --user


来源:https://stackoverflow.com/questions/38087558/import-error-no-module-named-skimage

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!