Cannot import scipy.misc.imread

后端 未结 8 1143
南笙
南笙 2020-12-24 04:55

I\'ve seen this problem before with other people, but haven\'t found a fix.

All I\'m trying to do is:

from scipy.misc import imread

and

相关标签:
8条回答
  • 2020-12-24 04:59

    You can try from scipy.misc.pilutil import imread instead of from scipy.misc import imread

    Please check the GitHub page : https://github.com/amueller/mglearn/issues/2 for more details.

    0 讨论(0)
  • 2020-12-24 05:00

    The method imread in scipy.misc requires the forked package of PIL named Pillow. If you are having problem installing the right version of PIL try using imread in other packages:

    from matplotlib.pyplot import imread
    im = imread(image.png)
    

    To read jpg images without PIL use:

    import cv2 as cv
    im = cv.imread(image.jpg)
    
    0 讨论(0)
  • 2020-12-24 05:00

    Expanding on user_3pij's answer

    If you want to work with a scipy version that is higher than 1.3.0 then, as instructed in the scipy's documentation of the imread function, we can use the imageio module instead.

    To successfully use the imageio imread function in a way that replicates the functionality of scipy's imread you can follow the instructions described here (disclaimer: I haven't tried it myself yet)

    0 讨论(0)
  • 2020-12-24 05:06

    If you have Pillow installed with scipy and it is still giving you error then check your scipy version because it has been removed from scipy since 1.3.0rc1.

    rather install scipy 1.1.0 by :

    pip install scipy==1.1.0

    check https://github.com/scipy/scipy/issues/6212

    0 讨论(0)
  • 2020-12-24 05:06

    I received errors when trying to use

    from scipy.misc import imread
    

    I was able to remove the errors and use the above line by first installing numpy+mkl and then installing scipy from Christoph Gohlke's website.

    For me this was:

    pip install numpy-1.11.1+mkl-cp27-cp27m-win32.whl
    pip install scipy-0.17.1-cp27-cp27m-win32.whl
    

    You will need to pick the correct version of the whl's for your system.

    Also, make sure the pip command installs the modules. If you have any 1 or more of these already installed, you might need to use pip to force a reinstall.

    0 讨论(0)
  • 2020-12-24 05:08

    looking into the documentation it says scipy.misc.imread is deprecated. It says to install imageio, and to use imageio.imread instead. Works great!

    0 讨论(0)
提交回复
热议问题