安裝
建議直接使用pip安裝,我用pycharm安裝更換源後不行。
使用cmd下pip安裝會報錯大概原因是校園網會牆,熱點可以。下面這條語句也可以。
pip install tensorflow -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
問題 1 :
ERROR: Cannot uninstall ‘wrapt’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
解決 :
pip install -U --ignore-installed wrapt enum34 simplejson netaddr
問題 2 :
2019-11-18 22:59:15.598570: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
這個原因是因爲通過上面的方式下載的tensorflow版本不支持AVX2指令集導致的。
解決1:
頂部直接導入暫時性忽略掉。
import os
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='1' # 這是默認的顯示等級,顯示所有信息
os.environ["TF_CPP_MIN_LOG_LEVEL"]='2' # 只顯示 warning 和 Error
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='3' # 只顯示 Error
解決2:
參考
https://blog.csdn.net/Fourierrr_/article/details/79749899