我正在使用一台ubuntu14.04机器,试图导入谷歌.protobuf模块到Python2.7中。在
我试过了
apt-get python-protobuf
以及
^{pr2}$没有成功。在
在python中,我得到一个错误消息:
"ImportError: No module named google.protobuf"
编辑1:
很抱歉,谢谢所有发表评论的人。我对Ubuntu和StackOverflow还是个新手。在
具体地说,我键入命令行
python
import google.protobuf
得到反馈
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google.protobuf
然后我打字
exit()
我试着输入
sudo apt-get install python-protobuf
它的反应是
Reading package lists... Done Building dependency tree
Reading state information... Done python-protobuf is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 283 not upgraded.
然后我回到python并尝试
import google.protobuf
我又犯了同样的错误。在
最后,我试过了
pip install protobuf
它的回答是
Requirement already satisfied: protobuf in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: six>=1.9 in /usr/local/lib/python2.7/dist-packages (from protobuf)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from protobuf)
我试过了
python
import google.protobuf
得到了完全相同的错误。放置
import protobuf
into python也会得到相同的错误。在
一些相关信息:我已经尝试用apt-get和pip进行多次卸载/重新安装,以修复错误,没有任何更改。另外,我在得到Ubuntu后做的第一件事就是从网站上下载python2.7并安装它,没有意识到python是随Ubuntu一起来的。在
再次感谢。在
相关问题 更多 >
编程相关推荐