遇到2次了,記錄一下:
在執行含有import tensorflow as tf的代碼中,報錯如下:
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_quint8 = np.dtype([("quint8", np.uint8, 1)])
原因:
這是因爲numpy版本過高了,降低numpy版本即可消除。
查看自己numpy版本:
打開Aanconda prompt
輸入:python,進入python環境
import numpy as np
np.__version__
會打印出當前numpy版本,我的是1.17.4
解決方法:
1、找到當前numpy的安裝目錄,刪除
import numpy as np
np.__file__
會打印出numpy的安裝路徑,刪除
2、降低版本
一般降低1到2個版本應該可以了。
pip install numpy==1.16.0
或者 pip install -U numpy==1.16.0
如果不行,可以試下1.15.0版本。
參考:https://blog.csdn.net/bigdream123/article/details/99467316下的評論。