python中调用 imread 报错: ImportError: cannot import name imread

python中调用 imread 报错: ImportError: cannot import name imread - xiao_lxl的专栏 - CSDN博客

http://blog.csdn.net/xiao_lxl/article/details/52411918


现象:


from scipy.misc import imread,imresize 

报错

提示错误

...

ImportError: cannot import name imread


但是import scipy的时候 显示正确。


解决方案:


需要install PIL or Pillow.

登陆网址 http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy 

下载

  • Pillow-3.3.1-cp27-cp27m-win32.whl

pip install 之后显示正确。


测试:


[python]  view plain  copy
 print ?
  1. import numpy as np  
  2. from scipy.misc import imread, imresize  
  3. import matplotlib.pyplot as plt  
  4.   
  5. img = imread('M:/work/Pic/brightness/10.jpg')  
  6. img_tinted = img * [10.950.9]  
  7.   
  8. # 显示原始图片  
  9. plt.subplot(121)  
  10. plt.imshow(img)  
  11.   
  12. # 显示调色后的图片  
  13. plt.subplot(122)  
  14. plt.imshow(np.uint8(img_tinted))  
  15.   
  16. plt.show()  

处理结果



posted on 2017-11-21 11:13  yusisc  阅读(55)  评论(0编辑  收藏  举报

导航