python - ModuleNotFoundError:没有名为“skimage”的模块
问题描述
我已经在以下路径上安装了我的 scikit-image:要求已经满足:scikit-image
我已经从 PyCharm 的解释器中安装了它
但是,每当我运行以下
from skimage import data
from skimage.feature import register_translation
from skimage.feature.register_translation import _upsampled_dft
它不断返回错误,如下所示:
ImportError: No module named skimage
import numpy as np
import matplotlib.pyplot as plt
from skimage import data
from skimage.feature import register_translation
from skimage.feature.register_translation import _upsampled_dft
from scipy.ndimage import fourier_shift
image = data.camera()
shift = (-22.4, 13.32)
# The shift corresponds to the pixel offset relative to the reference image
offset_image = fourier_shift(np.fft.fftn(image), shift)
offset_image = np.fft.ifftn(offset_image)
print("Known offset (y, x): {}".format(shift))
# pixel precision first
shift, error, diffphase = register_translation(image, offset_image)
fig = plt.figure(figsize=(8, 3))
ax1 = plt.subplot(1, 3, 1)
ax2 = plt.subplot(1, 3, 2, sharex=ax1, sharey=ax1)
ax3 = plt.subplot(1, 3, 3)
ax1.imshow(image, cmap='gray')
ax1.set_axis_off()
ax1.set_title('Reference image')
ax2.imshow(offset_image.real, cmap='gray')
ax2.set_axis_off()
ax2.set_title('Offset image')
# Show the output of a cross-correlation to show what the algorithm is
# doing behind the scenes
image_product = np.fft.fft2(image) * np.fft.fft2(offset_image).conj()
cc_image = np.fft.fftshift(np.fft.ifft2(image_product))
ax3.imshow(cc_image.real)
ax3.set_axis_off()
ax3.set_title("Cross-correlation")
plt.show()
此导入失败的原因是什么?
解决方案
由于您使用的是 PyCharm,我认为您必须检查您是否已将软件包安装在您正在使用的同一环境中。
推荐阅读
- r - 使用闪亮的 URL 书签恢复输入值并重新运行计算
- nlp - 无法更新 VADER 词典
- c# - 如何在 c# 中解析 3.7 到 3700 int
- c# - 自定义类作为迭代器中的返回
- asp.net-core - 在 ASP.NET Core 中使用 Sustainsys.Saml2 动态添加 SAML2 身份验证提供程序
- python - Pip3 找不到/安装模块
- restsharp - Rest Sharp 的 AddJsonBody 在 url 中而不是在 body 中发送参数以进行 POST 请求
- json - 如何过滤json路径中的非数组元素?
- javascript - 如何防止在表单提交中传递空白 UTM 值?
- php - PHP readfile() 下载原始文件的精确副本