0

尝试导入时出现以下错误simpletransformers

Traceback (most recent call last):

  File "...py", line 106, in <module>

    from simpletransformers.classification import ClassificationModel, ClassificationArgs

  File "/home/work/anaconda/lib/python3.6/site-packages/simpletransformers/classification/__init__.py", line 1, in <module>

    from simpletransformers.classification.classification_model import ClassificationModel

  File "/home/work/anaconda/lib/python3.6/site-packages/simpletransformers/classification/classification_model.py", line 32, in <module>

    from tensorboardX import SummaryWriter

  File "/home/work/anaconda/lib/python3.6/site-packages/tensorboardX/__init__.py", line 4, in <module>

    from .record_writer import RecordWriter

  File "/home/work/anaconda/lib/python3.6/site-packages/tensorboardX/record_writer.py", line 18, in <module>

    from google.cloud import storage

  File "/home/work/anaconda/lib/python3.6/site-packages/google/cloud/storage/__init__.py", line 38, in <module>

    from google.cloud.storage.batch import Batch

  File "/home/work/anaconda/lib/python3.6/site-packages/google/cloud/storage/batch.py", line 29, in <module>

    from google.cloud import _helpers

  File "/home/work/anaconda/lib/python3.6/site-packages/google/cloud/_helpers.py", line 33, in <module>

    from google.protobuf import duration_pb2

  File "/home/work/anaconda/lib/python3.6/site-packages/google/protobuf/duration_pb2.py", line 21, in <module>

    create_key=_descriptor._internal_create_key,

AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

我已经尝试升级protobuf并拥有与protoc此问题相同的版本: 如何解决“AttributeError:模块'google.protobuf.descriptor'没有属性'_internal_create_key”?

我也尝试升级其他软件包。还有什么问题?

我在云 linux 机器上遇到问题。在我的本地 Windows 机器上,没有问题。

4

2 回答 2

2

我通过 pip show protobuf 和 protoc --version 得到的 protoc 版本是不同的。pip 中的版本有点过时了。

在我升级 pip 版本之后

pip install --upgrade protobuf

问题解决了。

如果是 python3,请使用pip3 install --upgrade protobuf

于 2021-06-09T14:39:51.597 回答
0

我遇到了相同的protobuf版本等于问题,protoc错误仍然存​​在。但是重新启动我的计算机后,它的工作。

于 2021-08-16T17:53:46.820 回答