Tensorflow安装在Windows错误上?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (181)

Tensorflow现在可在Windows上使用:

 https://developers.googleblog.com/2016/11/tensorflow-0-12-adds-support-for-windows.html

我使用了pip install tensorflow。

我尝试运行介绍代码:

 https://www.tensorflow.org/versions/r0.12/get_started/index.html

我收到此错误:

C:\Python\Python35-32\python.exe "C:/tensorflow_tutorial.py"
Traceback (most recent call last):
  File "C:\Python\Python35-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
return importlib.import_module(mname)
  File "C:\Python\Python35-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 986, in _gcd_import
   File "<frozen importlib._bootstrap>", line 969, in _find_and_load
   File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
   File "<frozen importlib._bootstrap>", line 577, in module_from_spec
   File "<frozen importlib._bootstrap_external>", line 903, in create_module
   File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
 ImportError: DLL load failed: %1 is not a valid Win32 application.

这个网站有一些关于DLL的建议,但有人猜测是好的:

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

我切换到x64我收到此错误:

I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cublas64_80.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_blas.cc:2294] Unable to load cuBLAS DSO.
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cudnn64_5.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:3459] Unable to load cuDNN DSO
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cufft64_80.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_fft.cc:344] Unable to load cuFFT DSO.
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library nvcuda.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_diagnostics.cc:165] hostname: ����

UPDATE2:

我安装了nvidia cuda文件

 https://developer.nvidia.com/cuda-downloads

我得到这些错误:

I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cublas64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cudnn64_5.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:3459] Unable to load cuDNN DSO
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cufft64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library nvcuda.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_diagnostics.cc:165] hostname: �٩��

我从NVIDIA注册并下载了cudnn packge

 https://developer.nvidia.com/cudnn

移动了文件位置

C:\Desktop\cudnn-8.0-windows10-x64-v5.1.zip\cuda\bin\cudnn64_5.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\cudnn64_5.dll

仍然会收到此错误:

 I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library nvcuda.dll
提问于
用户回答回答于

从Python解释器(C:\Python\Python35-32)的路径看,似乎使用的是32位版本的Python 3.5。官方TensorFlow软件包仅适用于64位体系结构(x64/ amd64),因此有两种选择:

  1. 安装64位版本的Python 3.5(来自Python.org或Anaconda)
  2. 自己编译PIP包以获得32位Python 3.5。可以使用实验性的CMake构建来执行此操作,但这不是受支持或经过测试的配置。
用户回答回答于

问题不在于平台(amd64),而在于GPU驱动程序。你需要安装在CPU上运行的软件包或使用已安装的GPU,但也要安装CUDA驱动程序。

扫码关注云+社区

领取腾讯云代金券

年度创作总结 领取年终奖励