Python错误:没有名为skimage.io的模块

2024-04-19 11:11:49 发布

您现在位置:Python中文网/ 问答频道 /正文

当我在Python中运行此程序时,它会显示以下错误:

ImportError: No module named skimage.io.

我已经运行了pip install scikit-image命令,但仍然出现此错误。你能帮帮我吗

这是我的代码:

import matplotlib.pyplot as plt
import skimage.io as io
import skimage.color as color

parrots = io.imread('C:\Python27\Example\parrots.bmp')

parrots_hsv= skcolor.convert_colorspace(parrots, 'RGB','HSV')

fig, ax= plt.subplots(nclos = 2, figsize=('8,4'))
ax[0].imshow(parrots)
ax[0].set_title('original image')

restored_image =skcolore.convert_colorspace(parrots_hsv, 'HSV','RGB')
ax[1].imshow(restored_image)
ax[1].set_title('restored image')
plt.show()`enter code here`

Tags: ioimageimportconvertas错误pltrgb
1条回答
网友
1楼 · 发布于 2024-04-19 11:11:49

我这样重复了这个错误:

import math.sqrt as sq

print(sq(4))

错误:

  File ".\Solution.py", line 1, in <module>
    import math.sqrt as sq
ModuleNotFoundError: No module named 'math.sqrt'; 'math' is not a package

修理人:

from math import sqrt as sq

print(sq(4))

因此,我假设如果您将导入更改为以下代码,它可能会修复它:

from matplotlib import pyplot as plt
from skimage import io as io
from skimage import color as color

此外,您可能需要阅读一些here来了解有关导入的简单解释

相关问题 更多 >