[英]Tensorflow-gpu not installed properly in windows machine
I am trying to install tensorflow-gpu in my new windows system. 我正在尝试在新的Windows系统中安装tensorflow-gpu。 But am encountering this error
但是遇到这个错误
>>> 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.
This question has been asked before and I have gone through those but I am not able to figure why this is not working. 之前已经问过这个问题,我已经解决了这些问题,但是我无法弄清为什么它不起作用。
Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found Windows上的Tensorflow-ImportError:DLL加载失败:找不到指定的模块
https://github.com/tensorflow/tensorflow/issues/10033 https://github.com/tensorflow/tensorflow/issues/10033
I have added all the paths to the environment variables based on this post https://medium.com/@viveksingh.heritage/how-to-install-tensorflow-gpu-version-with-jupyter-windows-10-in-8-easy-steps-8797547028a4 我根据这篇文章https://medium.com/@viveksingh.heritage/how-to-install-tensorflow-gpu-version-with-jupyter-windows-10-in-8添加了所有环境变量的路径-easy-steps-8797547028a4
The versions I am using are 我使用的版本是
Python: 3.6.7
CUDA: 10.0.130
cuDNN: 7.3.1
I suggest you try using Anaconda 我建议您尝试使用Anaconda
Summarizing: 1. Install Miniconda or Anaconda and then go to "Anaconda Prompt": simple use Windows and start to write "anaconda" after installing: it should appear. 总结:1.安装Miniconda或Anaconda,然后转到“ Anaconda Prompt”:简单使用Windows,并在安装后开始编写“ anaconda”:它应该出现。 2. Now, simply run:
2.现在,只需运行:
conda create --name tf_gpu tensorflow-gpu conda创建--name tf_gpu tensorflow-gpu
Done! 做完了! To be sure, you can test it:
可以肯定的是,您可以对其进行测试:
In "Anaconda Prompt": 在“ Anaconda提示”中:
Activate environment using ‘activate tf_env’.
Go to python console using ‘python’
In Python, just write: 在Python中,只需编写:
import tensorflow as tf sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) 导入tensorflow为tf sess = tf.Session(config = tf.ConfigProto(log_device_placement = True))
Info about your card should appear. 有关您卡的信息应出现。 Now, just create a new project in your IDE, choosing "Existing Interpreter", selecting the Virtual Envirment that we just created ("tf_gpu"), and your new files inside the project will run on the gpu.
现在,只需在IDE中创建一个新项目,选择“现有解释器”,选择我们刚刚创建的虚拟环境(“ tf_gpu”),项目中的新文件将在gpu上运行。
Hope I helped! 希望我能帮上忙! Thanks to Harveen Singh (I tried many tutorials, before seeing one that worked and was easy)
多亏了Harveen Singh(我尝试了许多教程,然后才看到有效且简单的教程)
TF supports CUDA 9.0. TF支持CUDA 9.0。
Follow these instructions 请遵循以下指示
https://www.tensorflow.org/install/gpu https://www.tensorflow.org/install/gpu
https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/ https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.