簡體   English   中英

Tensorflow-gpu在Windows機器中未正確安裝

[英]Tensorflow-gpu not installed properly in windows machine

我正在嘗試在新的Windows系統中安裝tensorflow-gpu。 但是遇到這個錯誤

>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\AppData\Local\Programs\Python\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:\Users\user\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\AppData\Local\Programs\Python\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:\Users\user\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

之前已經問過這個問題,我已經解決了這些問題,但是我無法弄清為什么它不起作用。

Windows上的Tensorflow-ImportError:DLL加載失敗:找不到指定的模塊

https://github.com/tensorflow/tensorflow/issues/10033

我根據這篇文章https://medium.com/@viveksingh.heritage/how-to-install-tensorflow-gpu-version-with-jupyter-windows-10-in-8添加了所有環境變量的路徑-easy-steps-8797547028a4

我使用的版本是

Python: 3.6.7 
CUDA: 10.0.130
cuDNN: 7.3.1

我建議您嘗試使用Anaconda

請參閱本教程

總結:1.安裝Miniconda或Anaconda,然后轉到“ Anaconda Prompt”:簡單使用Windows,並在安裝后開始編寫“ anaconda”:它應該出現。 2.現在,只需運行:

conda創建--name tf_gpu tensorflow-gpu

做完了! 可以肯定的是,您可以對其進行測試:

在“ Anaconda提示”中:

Activate environment using ‘activate tf_env’.
Go to python console using ‘python’

在Python中,只需編寫:

導入tensorflow為tf sess = tf.Session(config = tf.ConfigProto(log_device_placement = True))

有關您卡的信息應出現。 現在,只需在IDE中創建一個新項目,選擇“現有解釋器”,選擇我們剛剛創建的虛擬環境(“ tf_gpu”),項目中的新文件將在gpu上運行。

希望我能幫上忙! 多虧了Harveen Singh(我嘗試了許多教程,然后才看到有效且簡單的教程)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM