我正在使用skimage在Python上编写代码。但是在使用skimage.segmentation时遇到了导入错误。
跟踪(最近的调用):
文件“superpixel.py”,第5行,
从skimage.segmentation中导入slic
导入错误:没有名为skimage.segmentation的模块
我正在使用skimage在Python上编写代码。但是在使用skimage.segmentation时遇到了导入错误。
跟踪(最近的调用):
文件“superpixel.py”,第5行,
从skimage.segmentation中导入slic
导入错误:没有名为skimage.segmentation的模块
您可以使用pip install scikit-image
。
同时请参阅建议的安装步骤。
sudo apt-get install python-matplotlib python-numpy python-pil python-scipy
显然,skimage是Cython的一部分,而Cython又是Python的一个超集,因此您需要安装Cython才能使用skimage。
sudo apt-get install build-essential cython
现在使用以下命令安装skimage包
sudo apt-get install python-skimage
这对我解决了导入错误。
sudo apt-get install python-skimage
和 sudo apt-get install python3-tk
。 - Alexander Pachasudo apt-get install python-skimage
命令即可。 - Gaurav你需要激活你的环境:
例如,.\Env 文件夹\Scripts\ac
然后:
python -m pip install scikit-image
针对OSX操作系统: pip install scikit-image
然后运行Python尝试以下内容:
from skimage.feature import corner_harris, corner_peaks
import sys
!conda install --yes --prefix {sys.prefix} scikit-image
如果你有多个python版本并想使用python3.5进行安装,以下是适用于python 3.5的安装方法:
pip3 install scikit-image --user
我尝试使用:
pip install scikit-image
虽然显示安装成功,但在我导入skimage
时仍会出现NoModuleFoundError
错误。
以下命令对我有效:
python -m pip install -U scikit-image
我尝试了pip安装,但没有成功。最终我通过尝试其他方法解决了这个问题。
conda install scikit-image
如需安装scikit-image的更多信息,请访问以下网站:https://scikit-image.org/docs/dev/install.html
对于基于Debian的发行版:
sudo apt-get install python3-skimage
如果您将其用于Python 2脚本:
sudo apt-get install python-skimage