警告:FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
np_resource = np.dtype([(“resource”, np.ubyte, 1)]) 导致程序无法正常运行。
**错误原因:**如上所示,是numpy的版本太新(>=1.17),新版本部分语法有变动与tensorflow/python不兼容导致。
**解决办法:**降numpy版本
在命令行中输入:
pip install numpy==1.16.4
总结:这是笔者第一次看到因为Warning而使程序中断的。(以前都习惯于查找Error部分) 此次事件貌似是因为某次我更新了pip包,默认自动更新了numpy组件,导致无意中程序突然无法运行了。说到底还是兼容性的问题!