繁体   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