微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。