无法导入 Google Protobuf Python 模块
Unable to Import Google Protobuf Python Module
我正在使用 Ubuntu 14.04 机器,试图将 google.protobuf 模块导入 python 2.7.
我试过了
apt-get python-protobuf
和
pip install protobuf
没有成功。
在 python 中,我收到一条错误消息:
"ImportError: No module named google.protobuf"
编辑 1:
抱歉并感谢所有发表评论的人。我还是 Ubuntu 和 Whosebug 的新手。
具体来说,我在命令行中输入
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
进入python也得到同样的错误。
一些相关信息:我已经尝试使用 apt-get 和 pip 进行多次 uninstalls/reinstalls 来修复错误,但没有任何改变。此外,我在获得 Ubuntu 后做的第一件事就是从网站下载 python 2.7 并安装它,但没有意识到 python 附带了 Ubuntu.
再次感谢。
pip install --ignore-installed six
sudo pip install protobuf
我正在使用 Ubuntu 14.04 机器,试图将 google.protobuf 模块导入 python 2.7.
我试过了
apt-get python-protobuf
和
pip install protobuf
没有成功。
在 python 中,我收到一条错误消息:
"ImportError: No module named google.protobuf"
编辑 1:
抱歉并感谢所有发表评论的人。我还是 Ubuntu 和 Whosebug 的新手。
具体来说,我在命令行中输入
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
进入python也得到同样的错误。
一些相关信息:我已经尝试使用 apt-get 和 pip 进行多次 uninstalls/reinstalls 来修复错误,但没有任何改变。此外,我在获得 Ubuntu 后做的第一件事就是从网站下载 python 2.7 并安装它,但没有意识到 python 附带了 Ubuntu.
再次感谢。
pip install --ignore-installed six
sudo pip install protobuf