記錄,自用
1、安裝Anaconda(這里安裝的是python3.6版本)
2、創建tensorflow的conda環境
1 conda create -n tensorflow python=3.6
3、切換到上一步創建的名為“tensorflow”的python解釋器環境
1 activate tensorflow
4、分別安裝tensorflow和keras
版本兼容性參考:https://docs.floydhub.com/guides/environments/
這里選擇TensorFlow 1.4.0 + Keras 2.0.8 on Python 3.6.
1 pip install tensorflow==1.4.0 2 pip install keras==2.0.8
5、遇到問題1
在該環境使用python解釋器,可以正常使用tensorflow
當在該環境下打開jupyter notebook,運行import tensorflow as tf,報錯
“ImportError: No module named tensorflow"
解決方案:
1 conda install nb_conda
6、遇到問題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版本
1 pip install numpy==1.16.0
7、成功