tensorflow報錯raise RuntimeError('The Session graph is empty. Add operations to the '
RuntimeError: The Session graph is empty. Add operations to the graph before calling run().
這個是在安裝tensorflow的時候爲了測試安裝是否成功,然後就用了網上的方法,但是在運行如下代碼的時候卻產生了錯誤
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='1' # 這是默認的顯示等級,顯示所有信息
os.environ["TF_CPP_MIN_LOG_LEVEL"]='2'
一開始是懷疑自己本地問題tensorflow沒有下載全,後來百度了下沒有解決,又想到是不是安裝過程出錯了,問題還真的就在這裏,在我創建好tensorflow環境後,執行pip install tensorflow 這個默認下載的是2.0.0版本的,但是conda卻不支持,所以我們在下載前要看看conda支持的tensorflow
版本,執行下邊命令conda search --full -name tensorflow,如圖