当前位置: 首页 > 面试题库 >

没有名为'_pywrap_tensorflow_internal'的模块

左丘源
2023-03-14
问题内容

在尝试验证tensorflow-gpu的安装时,尝试执行“将tensorflow作为tf导入”时出现了ImportError。我在Windows
7上使用Quadro K620。Tensorflow使用pip安装。

以下是堆栈跟踪:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\aagarwal>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_hel
per
    return importlib.import_module(mname)
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\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 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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 "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_hel
per
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_
_init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_hel
per
    return importlib.import_module(mname)
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\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 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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 "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_hel
per
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_
_init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems

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

我看过其他多个堆栈溢出帖子,例如纠正路径之类的内容,但我无法解决此问题。


问题答案:

我今天遇到了同一问题,请改用Windows的cuDNN v5.1库,而不是按照@mickdelaney的建议进行操作,然后尝试

  1. 检查CUDA的环境设置,通常所有CUDA的设置都已添加到Windows环境中

  2. 在复制文件binlibincludecuDNN来binlibincludeCUDA的分别。通常目录是C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA

然后您可以导入tensorflow并运行您的代码。祝好运!



 类似资料:
  • 嗨,我正在学习线性代数与python的Edx课程。(http://nbviewer.ipython.org/github/ULAFF/notebooks/tree/may-14-2014/). 在第一个框中的“02.4.2.10矩阵向量乘法练习”中,代码为: 生成问题是Edx教授创建的一个模块。但是,我在导入Symphy时出错。 我得到的错误如下: 我下载并安装了症状,如果我导入,它可以在终端(苹

  • 问题内容: 我正在将Django应用程序部署到开发服务器,并且在运行时遇到此错误: 似乎与一起分发。最初,我认为这可能不会安装到virtualenv中的Python,所以我使用以下命令将了(与Python相同的版本)安装到virtualenv 中的Python站点软件包: 编辑:这只发生在virtualenv内部。如果我在virtualenv外部打开控制台,则该控制台存在,但仍然出现相同的错误。

  • 问题内容: 我有这个问题: 我已经安装了PIL,但仍然无法正常工作。我使用OSX。 我正在尝试为Django Simple Captcha安装此模块。 问题答案: 克里斯托弗的建议对我来说非常有效。 详细信息如下:1.卸载现有的Python Imaging Library 下载并解压缩源版本(从此处 http://effbot.org/downloads/Imaging-1.1.6.tar.gz)

  • 问题内容: 卸载旧的Django版本后,我已经更新到最新的Django版本1.0.2。但是现在当我运行django-admin.py时,出现以下错误。我该如何解决? 问题答案: 你必须确保django在你的PYTHONPATH中。 要进行测试,只需在python shell中执行即可。应该没有输出: 如果你安装的Django通过(或与附带的),然后在你检查site-packages,如果文件(.)

  • 问题内容: 我正在使用Python 2.5.4版并安装MySQL 5.0版和Django。Django在Python上运行良好,但在MySQL上运行良好。我在Windows Vista中使用它。 问题答案: 你需要使用以下命令之一。哪一个取决于你拥有和使用的操作系统和软件。 easy_install mysql-python(混合OS) pip安装mysql-python(mix os / pyt

  • 问题内容: 我正在安装tweepy,但是遇到了关于pip.req的错误。我已经安装了pip,但是由于某些原因,仍然找不到pip.req。我在网上做了很多研究,发现最多的是有关zapo(?)和python 2.7之间不兼容的问题,导致其他用户遇到相同的错误。不过,关于如何解决问题的讨论尚不清楚。谢谢! 问题答案: 如果您有以下代码,它似乎可以工作: 做这个: 创建一个目录 添加一个空文件 添加文件