无法导入TensorFlow和Keras

时间:2019-03-05 13:07:09

标签: python tensorflow keras

我无法导入TensorFlow&Keras。我已经成功安装了它们两个,并且也可以看到版本,但是在导入时出现以下错误。

ImportError: DLL load failed: The specified procedure could not be found.

Product Versions

Python Version - 3.6
---
Anaconda Version - 4.3.1
--
Keras Version - 2.2.4
--------------------
TensorFlow Version - 1.31.1
-------------------------------

ImportError: DLL load failed: The specified procedure could not be found.

ImportError                               Traceback (most recent call last)
<ipython-input-1-41389fad42b5> in <module>()
1 import tensorflow as tf

C:\Users\kolasay\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py in <module>()
     22 
     23 # pylint: disable=g-bad-import-order
    24 from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
     25 
     26 from tensorflow._api.v1 import app

C:\Users\kolasay\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\__init__.py in <module>()
     50 
     51 # Protocol buffers
     52 from tensorflow.core.framework.graph_pb2 import *
     53 from tensorflow.core.framework.node_def_pb2 import *
     54 from tensorflow.core.framework.summary_pb2 import *

C:\Users\kolasay\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\graph_pb2.py in <module>()
      4 import sys
      5 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
     6 from google.protobuf import descriptor as _descriptor
      7 from google.protobuf import message as _message
      8 from google.protobuf import reflection as _reflection

C:\Users\kolasay\AppData\Roaming\Python\Python36\site-packages\google\protobuf\descriptor.py in <module>()
     45   import binascii
     46   import os
    47   from google.protobuf.pyext import _message
     48   _USE_C_DESCRIPTORS = getattr(_message, '_USE_C_DESCRIPTORS', False)
     49 

ImportError: DLL load failed: The specified procedure could not be found.

1 个答案:

答案 0 :(得分:0)

以下是我的建议

https://github.com/protocolbuffers/protobuf/issues/5046

  1. 将Protobuf降级到稳定版本
  2. 将Python升级到3.6.1

将来我可能会建议使用像Google Colab这样的在线环境来进行玩具项目,因为这样比较省事。