Tensorflow無法啟動

2021-09-19 15:33:27 字數 3564 閱讀 1438

tensorflow 1.10-gpu,好不容易安裝成功的,昨天突然報告dll載入錯誤:

importerror: dll load failed with error code -1073741795

c:\>python

python 3.6.8 (tags/v3.6.8:3c6b436a57, dec 24 2018, 00:16:47) [msc v.1916 64 bit (amd64)] on win32

>>> import tensorflow as tf

traceback (most recent call last):

file "c:\program files\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import *

file "c:\program files\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper()

file "c:\program files\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper

_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)

file "c:\program files\python36\lib\imp.py", line 243, in load_module

return load_dynamic(name, filename, file)

file "c:\program files\python36\lib\imp.py", line 343, in load_dynamic

return _load(spec)

importerror: dll load failed with error code -1073741795

during handling of the above exception, another exception occurred:

traceback (most recent call last):

file "", line 1, in file "c:\program files\python36\lib\site-packages\tensorflow\__init__.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import

file "c:\program files\python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow

file "c:\program files\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise importerror(msg)

importerror: traceback (most recent call last):

file "c:\program files\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import *

file "c:\program files\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper()

file "c:\program files\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper

_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)

file "c:\program files\python36\lib\imp.py", line 243, in load_module

return load_dynamic(name, filename, file)

file "c:\program files\python36\lib\imp.py", line 343, in load_dynamic

return _load(spec)

importerror: dll load failed with error code -1073741795

failed to load the native tensorflow runtime.

see

for some common reasons and solutions. include the entire stack trace

above this error message when asking for help.

>>> exit()

網上搜尋一下, 大概的意思可能是cuda的某個庫無法加載入?

考慮到最近沒有公升級過cuda,所以排除cuda相關的問題,或許跟最近新安裝的某個tensorflow模組有關。

重新安裝tensorflow安裝包無效,仍然報告同樣錯誤:

pip install tensorflow_gpu-1.10.0-cp36-cp36m-win_amd64.whl
還好之前在tesnsorflow安裝好後,把目錄 c:\program files\python36 備份為zip檔案了。

現在把壞的python36目錄重新命名為python36.bad,然後解壓縮之前的zip檔案為python36目錄。

試著執行tensorflow,已經恢復正常了:

c:\users\joy9\downloads>python

python 3.6.8 (tags/v3.6.8:3c6b436a57, dec 24 2018, 00:16:47) [msc v.1916 64 bit (amd64)] on win32

>>> import tensorflow as tf

>>> tf.__version__

'1.10.0'

>>>

>>>

tensorflow中無法使用Session

attributeerror module tensorflow has no attribute session tensorflow從2.0版本已經沒有session了,除了session,還有placeholder等舊版本的方法都不可以直接呼叫。imprt之後加一句tf.compat.v1.d...

Oracle HttpServer 無法啟動的問題

錯誤 事件檢視器 fastcgiserver redefinition of a previously defined fastcgi server e oracle ora92 bin isqlplus syntax error on line 92 of e oracle ora92 sqlpl...

Rails console 無法啟動

leslin leslinubt workspace rorails leslincms rails console usr local ruby lib ruby gems 1.9.1 gems railties 3.0.8 lib rails script rails loader.rb 11 ...