如題干所述,scipy 里面的 imread 讀取圖片會出錯,代碼如下:
from scipy import misc misc.imread("picture/scipy子模塊.png")
報錯信息為:
D:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py:3: DeprecationWarning: `imread` is deprecated! `imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``imageio.imread`` instead. This is separate from the ipykernel package so we can avoid doing imports until
解決方法:
閱讀以上報錯信息,發現需要調用 imageio.imread ,而 scipy 中沒有 scipy.imageio 子模塊。
查閱相關信息,了解到,imageio 是一個獨立的模塊。
代碼修改如下:
import imageio imageio.imread("picture/scipy子模塊.png")
