tensorflow 出錯module 'tensorflow' has no attribute 'layers'
出錯:module 'tensorflow' has no attribute 'layers'
解決方法:由於已經安裝的tensorflow是0.x的版本,0.x版本沒有layers模組所以程式出錯,需要重新安裝tensorflow 1.0以上的版本,即更新tensorflow版本。
檢視目前tensorflow版本
pip list
顯示:如下圖,此時的tensorflow為0.12.0版本
所以需要更新版本號。
cpu版本更新:
升級方法
1、首先啟用tensorflow環境(我的環境命名是grey)
activate grey
2、輸入以下安裝命令: GPU版本:
pip install --upgrade tensorflow-gpu
CPU版本:
pip install --upgrade tensorflow
博主為cpu版本,輸入pip install --upgrade tensorflow後回車就開始升級過程,會下載並解除安裝重灌一些必要的包,時間長短視網速而定。
經過幾分鐘的等待。更新完成:
啟動spyder 重新執行tensorflow程式。
執行結果已經沒有報錯。
哈哈哈哈!大功告成!
相關推薦
tensorflow 出錯module 'tensorflow' has no attribute 'layers'
出錯:module 'tensorflow' has no attribute 'layers' 解決方法:由於已經安裝的tensorflow是0.x的版本,0.x版本沒有layers模組所以程式出錯,需要重新安裝tensorflow 1.0以上的版本,即更新tensorf
成功解決AttributeError: module 'tensorflow.contrib.data' has no attribute 'TextLineDataset'
解決問題 AttributeError: module 'tensorflow.contrib.data' has no attribute 'TextLineDataset' 解決思路 tensorflow版本問題導致的函式呼叫有變更。 (1)、tf.data.TextLineDa
TensorFlow執行錯誤,AttributeError: module 'pandas' has no attribute 'computation'
TensorFlow執行錯誤,AttributeError: module ‘pandas’ has no attribute ‘computation’ 在我今天剛開始使用TensorFlow做數字識別時,在匯入input_data方法時,即是執行“from
error: ‘module’ object has no attribute ‘_rebuild_tensor_v2’
bject itl func hooks except attribute def ttr imp import torch._utils try: torch._utils._rebuild_tensor_v2 except AttributeError:
針對AttributeError: ‘module’ object has no attribute’xxx’的錯誤歸類
找不到 with 類型 error: 開頭 -a 發現 使用 def 目前遇見的有三種類型: 拼寫錯誤,模塊一定要拼寫錯誤,這個也是最容易犯的,發現找不到模塊的時候,最好先檢查一遍自己引入的模塊拼寫尤其是那些名字非常長的比如HTTPPasswordMgrWithDefau
module ‘markdown‘ has no attribute ‘version‘
anaconda har evel pycha 定位 oca arm 2.6 ttr 最近在寫一個CMDB的項目,遇到drf與django版本問題... 錯誤如下: AttributeError at / module ‘markdown‘ has no attribute
解決pycharm問題:module ‘pip‘ has no attribute ‘main‘
article 卸載 根據 sta 建議 pack blog htm tin 一:可能性解決方法一《解決pycharm問題:module ‘pip‘ has no attribute ‘main‘》http://www.cnblogs.com/Fordestiny/p/89
20180925:問題:pycharm中匯入flask-wtf失敗,報錯:module 'pip' has no attribute 'main'
前後臺頁面搭建完成,開始後臺邏輯操作。 在開始之前,根據視訊要匯入flask-wtf模組。在pycharm中匯入flask-wtf時,卻顯示報錯,錯誤最後一句提示:module 'pip' has no attribute 'main' 試圖在Termianl面
module 'h5py' has no attribute 'File' 解決辦法
之前執行一直沒有出現過的問題,現在換了環境總是出現 AttributeError: module 'h5py' has no attribute 'File' 解決辦法: AttributeError: module 'h5py' has no attribute 'F
module' object has no attribute 'urlretrieve'
python27的程式在python33中除錯時出現:‘module’ object has no attribute ‘urlretrieve’,的錯誤。 -- encoding:UTF-8 -- import urllib.request ‘module’
IDA執行加密演算法識別外掛findcrypt-yara報錯‘module’ object has no attribute’set_name’
10月12日 findcrypt下載的是github專案, 負責人似乎沒維護好,指令碼原始碼findcrypt3.py裡的195行出錯 idc.set_name(value[0], name
解決pycharm問題:module 'pip' has no attribute 'main'
解決pycharm問題:module ‘pip’ has no attribute ‘main’ 修改 do_install和 do_uninstall def do_install(pkgs):
Python 在import時明明寫的正確,卻提示錯誤AttributeError: module 'test003' has no attribute 'desc'
在自己寫一個小專案的時候,發現明明自己使用import引入自己專案中的另一個Python檔案是正確的寫法,在執行的時候卻發現總是提示錯誤。因為筆者本人也是學習Python不久,經過一個小時的琢磨,感覺應該是兩個檔案迴圈引用導致錯誤。比如一個a.py在使用的時候需要引用b.py
pytorch低版本載入高版本pytorch訓練得到的模型,出現‘module’ object has no attribute ‘_rebuild_tensor_v2’錯誤
情景 使用pytorch0.3來載入Mobilenetv1的模型(用更高版本的pytorch訓練得到的),出現“AttributeError: ‘module’ object has no attrib
module 'requests' has no attribute 'get'
pip install requests import requests ......... check your file name , requests.py ? refac
擴充套件包安裝問題:module 'pip' has no attribute 'main'
找到安裝目錄下 helpers/packaging_tool.py檔案,找到如下程式碼: def do_install(pkgs): try: import pip except ImportError: erro
AttributeError: module 'pip' has no attribute 'main'
Pycharm在執行pip安裝模組是報錯如下: 解決方法: 找到安裝路徑下的packaging_tool.py檔案修改如下: 我的路徑為D:\Program Files\JetBrains\PyCharm 2017.2.3\helpers\packaging_tool.py 原先: 修改後儲
python AttributeError module 'string' has no attribute 'upp
Traceback (most recent call last): File "Test1.py", line 8, in <module> upperletters = string.uppercaseAttributeError: module 'st
docker tvm :AttributeError: module 'tvm' has no attribute 'testing'
最近在搞tvm [官網:https://tvm.ai/], 我採用的docker的方式來快速入手的, 總體來說很簡單: 1. 獲取docker映象 sudo docker pull tvmai/demo-gpu 2. 執行docker映象, 注意這裡我們使用了GPU,
AttributeError: module 'requests' has no attribute 'Session'
AttributeError: module ‘requests’ has no attribute 'Session’ #使用requests執行人人網的登入和訪問會員中心並爬取資訊 import requests import re,time #獲取可以