在 Windows 上,运行“import tensorflow"生成没有名为“_pywrap_tensorflow"的模块;错误 [英] On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error

查看:31
本文介绍了在 Windows 上,运行“import tensorflow"生成没有名为“_pywrap_tensorflow"的模块;错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 上,TensorFlow 在执行 import tensorflow 语句后报告以下一个或两个错误:

On Windows, TensorFlow reports either or both of the following errors after executing an import tensorflow statement:

  • 没有名为_pywrap_tensorflow"的模块
  • DLL 加载失败.

推荐答案

问题是我的 cuDNN 库 - 无论出于何种原因 cudnn-8.0-windows10-x64-v6.0 无法正常工作 - 我使用了 cudnn-8.0-windows10-x64-v5.1 - 一切顺利!

The problem was the cuDNN Library for me - for whatever reason cudnn-8.0-windows10-x64-v6.0 was NOT working - I used cudnn-8.0-windows10-x64-v5.1 - ALL GOOD!

我的设置适用于 Win10 64 和 Nvidia GTX780M:

My setup working with Win10 64 and the Nvidia GTX780M:

  • 通过检查您的系统/路径确保您拥有 MSVCP140.DLL 库 - 如果没有得到它 这里
  • 此处运行适用于 python 3.5.3-amd64 的 Windows 安装程序- 不要尝试较新的版本,因为它们可能无法工作
  • 此处获取适用于 CUDA 8.0 的 cuDNN v5.1 - 将其放在您的users 文件夹或其他已知位置(您的路径中将需要此位置)
  • 此处
  • 获取 CUDA 8.0 x86_64
  • 按预期设置 PATH 变量以指向 cuDNN 库和 python(应在 python 安装期间添加 python 路径)
  • 确保.DLL"包含在您的 PATHEXT 变量中
  • 如果您使用的是 tensorflow 1.3,那么您想使用 cudnn64_6.dll github.com/tensorflow/张量流/问题/7705
  • Be sure you have the lib MSVCP140.DLL by checking your system/path - if not get it here
  • Run the windows installer for python 3.5.3-amd64 from here - DO NOT try newer versions as they probably won't work
  • Get the cuDNN v5.1 for CUDA 8.0 from here - put it under your users folder or in another known location (you will need this in your path)
  • Get CUDA 8.0 x86_64 from here
  • Set PATH vars as expected to point at the cuDNN libs and python (the python path should be added during the python install)
  • Make sure that ".DLL" is included in your PATHEXT variable
  • If you are using tensorflow 1.3 then you want to use cudnn64_6.dll github.com/tensorflow/tensorflow/issues/7705

如果您运行的是 Windows 32,请确保获得上述文件的 32 位版本.

If you run Windows 32 be sure to get the 32 bit versions of the files mentioned above.

这篇关于在 Windows 上,运行“import tensorflow"生成没有名为“_pywrap_tensorflow"的模块;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆