简体   繁体   English

尽管已安装模块,但 jupyter 笔记本中未定义 skimage

[英]skimage is not defined in jupyter notebook despite having installed the module

I created a virtual environment and installed scikitimage but when i use jupyter notebook it says no modules named skimage.我创建了一个虚拟环境并安装了 scikitimage,但是当我使用 jupyter notebook 时,它说没有名为 skimage 的模块。

I installed scikitimage without using virtual enviroment but still jupyter can't find it.我在没有使用虚拟环境的情况下安装了 scikitimage,但 jupyter 仍然找不到它。

from skimage import color, io
    def load(image_path):

        out = image_path

        out = skimage.io.imread(image_path)
        pass


    image1 = load(image1_path)

NameError                                 Traceback (most recent call last)
<ipython-input-3-08b9c4b0aed1> in <module>
----> 1 image1 = load(image1_path)
      2 image2 = load(image2_path)
      3 
      4 display(image1)
      5 display(image2)

~\Suleman\imageOperations.py in load(image_path)
     21     ### YOUR CODE HERE
     22     # Use skimage io.imread
---> 23     out = skimage.io.imread(image_path)
     24     pass
     25     ### END YOUR CODE

NameError: name 'skimage' is not defined
  1. first of all you need to uninstall scikit-image .Then首先你需要卸载scikit-image 。然后

  2. install it via shell/command prompt:通过 shell/命令提示符安装它:

    pip install scikit-image

  3. If you are running Anaconda or miniconda, open anaconda prompt then run this如果您正在运行 Anaconda 或 miniconda,请打开 anaconda 提示符然后运行此

    conda install -c conda-forge scikit-image

  4. if these steps aren't working upgrade your pip using如果这些步骤不起作用,请使用升级您的 pip

    python -m pip install –upgrade pip

  5. then follow again from step 1 to 3 that I have mentioned然后再次从我提到的第 1 步到第 3 步进行操作

If these aren't work uninstall scikit-image from both pip and conda then try this in anaconda prompt如果这些都不起作用,请从pipconda卸载scikit-image ,然后在 anaconda 提示符下尝试此操作

  1. conda config --add channels conda-forge
  2. conda install scikit-image
  3. conda search scikit-image --channel conda-forge
  1. Open CMD (the command prompt)打开 CMD(命令提示符)
  2. Type pip install scikit-image in the CMD window类型pip install scikit-image
  3. Type py in the CMD window在 CMD window 中键入py
  4. Type import skimage import skimage
  5. Go back to your Jupyter notebook for image processing issues Go 返回您的 Jupyter 笔记本以解决图像处理问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM