tensorflow2 报错ImportError: cannot import name ‘imread’
代码
from scipy.misc import imread
报错信息
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-8-5f5311cdf3ab> in <module>()
6 #import matplotlib.cbook as cbook
7 import time
----> 8 from scipy.misc import imread
9 from scipy.misc import imresize
10 import matplotlib.image as mpimg
ImportError: cannot import name 'imread'
解决方法
pip install scipy==1.2.1
报错原因
scipy 版本太高
ERROR: tensorflow 2.2.0 has requirement scipy==1.4.1; python_version >= "3", but you'll have scipy 1.2.1 which is incompatible.
Installing collected packages: scipy
Attempting uninstall: scipy
Found existing installation: scipy 1.4.1
Uninstalling scipy-1.4.1:
Successfully uninstalled scipy-1.4.1
Successfully installed scipy-1.2.1
好矛盾呀,ERROR: tensorflow 2.2.0 has requirement scipy1.4.1; 用tensorflow2,需要scipy1.41 而imread需要scipy1.21==