I installed Anaconda Python on my machine. When I start the Python Interpreter and type "import caffe" in the Python shell, I get the following error:
我在我的机器上安装了蟒蛇。当我启动Python解释器并在Python shell中输入“import caffe”时,我得到了以下错误:
ImportError: No module named google.protobuf.internal
I have the following files:
我有以下文件:
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
What files do I need so the import will work? Is there an "internal.h" file that is required?
我需要什么文件以便导入工作?有一个“内部。需要的文件吗?
3 个解决方案
#1
21
This is probably because you have two python environments in your machine, the one provided by your linux distribution(pip
) and the other by the anaconda environment (/home/username/anaconda2/bin/pip
).
这可能是因为您的机器中有两个python环境,一个由您的linux发行版(pip)提供,另一个由anaconda环境(/home/username/anaconda2/bin/pip)提供。
Try installing protobuf for both environments to be sure
pip install protobuf
pip安装protobuf
/home/username/anaconda2/bin/pip install protobuf
/home/username/anaconda2/bin/pip安装protobuf
#2
3
If you are using Ubuntu, try installing protobuf using
如果你正在使用Ubuntu,试试安装protobuf
sudo apt-get install protobuf
It solved the same problem that I faced.
它解决了我遇到的问题。
#3
1
If you are using Anaconda, do conda install protobuf
如果你正在使用蟒蛇,那就安装它吧
#1
21
This is probably because you have two python environments in your machine, the one provided by your linux distribution(pip
) and the other by the anaconda environment (/home/username/anaconda2/bin/pip
).
这可能是因为您的机器中有两个python环境,一个由您的linux发行版(pip)提供,另一个由anaconda环境(/home/username/anaconda2/bin/pip)提供。
Try installing protobuf for both environments to be sure
pip install protobuf
pip安装protobuf
/home/username/anaconda2/bin/pip install protobuf
/home/username/anaconda2/bin/pip安装protobuf
#2
3
If you are using Ubuntu, try installing protobuf using
如果你正在使用Ubuntu,试试安装protobuf
sudo apt-get install protobuf
It solved the same problem that I faced.
它解决了我遇到的问题。
#3
1
If you are using Anaconda, do conda install protobuf
如果你正在使用蟒蛇,那就安装它吧