0

全新安装带有更新的 Windows10(iCore 5、8Gb、64 位)。安装防病毒和防火墙。安装了 Docker 并拉取了 Tensorflow 镜像,并成功创建了运行良好的容器。然后我下载并安装了最新的 Anaconda 64bit for Windows,所有默认设置都在主机系统上。在主机系统上的时间之前没有安装 python。在 PATH 中,我将“%USERPROFILE%\AppData\Local\Microsoft\WindowsApps”移到了列表中,否则这个文件夹中的 python.exe 是默认的。这是主机系统上 PATH 变量的图片。

主机上 PATH 的屏幕截图

在主机上,我进行了 pip 升级并成功安装了 tensorflow,但正如您在下面尝试导入时看到的那样,出现此错误。我认为它特定于 Anaconda,因为我没有在 docker 容器中得到它,只安装了 Tensorflow 和 Jupyter Notebook。

已经查看了输出相似但没有答案的Request1Request2 。

任何帮助或指导将不胜感激。

(base) C:\Users\DNN>where python
C:\ProgramData\Anaconda3\python.exe

(base) C:\Users\DNN>python
Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\ProgramData\Anaconda3\lib\imp.py", line 342, 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:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\ProgramData\Anaconda3\lib\imp.py", line 342, 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/errors

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

1 回答 1

-1

设法获得有关我尝试过的 Tensorflow Github 发行说明的一些信息,它对我有用。

按照下面的文章安装 VSRedis,重新启动,我的 Tensorflow 正在主机上运行。

我的 Docker 容器可以正常工作,因为主机映像是 Linux,但这里我的主机 pc 是 Windows 并且似乎需要以下内容。可惜他们没有在 Anaconda 安装中包含这个。真的不得不为此去钓鱼。

来自 Github 发行说明: 这里

Windows 用户:官方发布的 tensorflow Pip 包现在使用 Visual Studio 2019 版本 16.4 构建,以利用新的 /d2ReducedOptimizeHugeFunctions 编译器标志。要使用这些新包,您必须安装“Microsoft Visual C++ Redistributable for Visual Studio 2015、2017 和 2019”,可从此处的 Microsoft 网站获得。

MS Visual Studio 可再发行组件

于 2020-02-02T19:52:39.827 回答