如何导入tensorflow而不会收到错误消息?

时间:2020-05-02 18:31:11

标签: python tensorflow

我已经通过pip3在Windows 10上成功安装了Tensorflow 2.1.0 CPU版本(tensorflow-2.1.0-cp36-cp36m-win_amd64.whl)。但是,当我尝试在Python 3.6.0中导入它时,出现以下错误:

import tensorflow
2020-05-02 20:17:07.633591: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-05-02 20:17:07.638884: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\python\__init__.py", line 64, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "C:\Users\ananas\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.

我已经对如何解决它进行了一些研究,发现问题可能是我还没有安装Visual Studio C ++。当我尝试安装tensorflow-cpu或其他版本的tensorflow时,仍然出现DLL导入错误,只是回溯略有不同。

0 个答案:

没有答案