簡體   English   中英

Python 錯誤導入錯誤:沒有名為 skimage.io 的模塊

[英]Python Error ImportError: No module named skimage.io

當我在 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`

我像這樣重現了這個錯誤:

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

此外,您可能想在這里閱讀一些有關導入的簡單說明。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM