导入caffe结果导致导入错误: "没有名为google.protobuf.internal的模块" (导入enum_type_wrapper)

2024-04-29 06:22:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我在我的机器上安装了Python。当我启动Python解释器并在Python shell中键入“import caffe”时,会出现以下错误:

ImportError: No module named google.protobuf.internal

我有以下文件:

wire_format_lite_inl.h
wire_format_lite.h
wire_format.h
unknown_field_set.h
text_format.h
service.h
repeated_field.h
reflection_ops.h
message_lite.h
message.h
generated_message_util.h
extension_set.h
descriptor.proto
descriptor.h
generated_message_reflection.h
generated_enum_reflection.h
dynamic_message.h
descriptor.pb.h
descriptor_database.h

我需要什么文件才能进行导入?是否需要“internal.h”文件?


Tags: 文件机器formatfieldmessage键入liteshell
3条回答

如果您使用的是Ubuntu,请尝试使用

sudo apt-get install protobuf

它解决了我面临的同样的问题。

这可能是因为您的机器中有两个python环境,一个由linux发行版提供(pip),另一个由anaconda环境提供(/home/username/anaconda2/bin/pip)。

尝试为两个环境安装protobuf以确保

pip install protobuf

/home/username/anaconda2/bin/pip install protobuf

如果你用的是水蟒,就要conda install protobuf

相关问题 更多 >