AttributeError:模块“ google.protobuf.descriptor_pool”没有属性“默认”

问题描述

有人可以告诉我如何解决此问题。我尝试了所有可以解决的问题。我正在使用Windows 10环境,其余操作如下,

Python 3.6.0 张量流2.3.0 Theano 0.9.0 protobuf 3.6.0

import json
from itertools import chain
from pprint import pprint
from time import time
import os

import numpy as np

from sklearn.metrics import accuracy_score

from gensim.models import Word2Vec
from gensim.corpora.dictionary import Dictionary


os.environ['THEANO_FLAGS'] = "device=gpu1"    
import theano
# theano.config.device = 'gpu' # Compute using GPU
# theano.config.floatX = 'float32'

from keras.preprocessing import sequence
from keras.models import Sequential,Model
from keras.layers import Input
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import LSTM
from keras.layers.core import Dense,Dropout
from keras.layers.wrappers import Timedistributed
from keras.utils.visualize_util import plot

np.random.seed(1337)

print (theano.config.device)

WARNING (theano.sandBox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
 https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

ERROR (theano.sandBox.cuda): nvcc compiler not found on $PATH. Check your nvcc installation and try again.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-e0ebe358a1df> in <module>()
     18 # theano.config.floatX = 'float32'
     19 
---> 20 from keras.preprocessing import sequence
     21 from keras.models import Sequential,Model
     22 from keras.layers import Input

~\Anaconda3\lib\site-packages\keras\__init__.py in <module>()
      1 
      2 try:
----> 3     from tensorflow.keras.layers.experimental.preprocessing import Randomrotation
      4 except ImportError:
      5     raise ImportError(

~\AppData\Roaming\Python\python36\site-packages\tensorflow\__init__.py in <module>()
     39 import sys as _sys
     40 
---> 41 from tensorflow.python.tools import module_util as _module_util
     42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
     43 

~\AppData\Roaming\Python\python36\site-packages\tensorflow\python\__init__.py in <module>()
     38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
     39 
---> 40 from tensorflow.python.eager import context
     41 
     42 # pylint: enable=wildcard-import

~\AppData\Roaming\Python\python36\site-packages\tensorflow\python\eager\context.py in <module>()
     30 import six
     31 
---> 32 from tensorflow.core.framework import function_pb2
     33 from tensorflow.core.protobuf import config_pb2
     34 from tensorflow.core.protobuf import rewriter_config_pb2

~\AppData\Roaming\Python\python36\site-packages\tensorflow\core\framework\function_pb2.py in <module>()
      8 from google.protobuf import message as _message
      9 from google.protobuf import reflection as _reflection
---> 10 from google.protobuf import symbol_database as _symbol_database
     11 # @@protoc_insertion_point(imports)
     12 

~\Anaconda3\lib\site-packages\google\protobuf\symbol_database.py in <module>()
    187 
    188 
--> 189 _DEFAULT = SymbolDatabase(pool=descriptor_pool.Default())
    190 
    191 

AttributeError: module 'google.protobuf.descriptor_pool' has no attribute 'Default'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...