【问题标题】:Why the import of google.protobuf works fine in ipython but not in python?为什么 google.protobuf 的导入在 ipython 中可以正常工作,但在 python 中却不行?
【发布时间】:2016-08-26 18:10:16
【问题描述】:

在 ipython 中

Python 2.7.11 |Anaconda 2.4.1 (64-bit)
IPython 3.1.0 -- An enhanced Interactive Python.

In [1]: import google.protobuf

In [2]:

然而在python中:

Python 2.7.11 |Anaconda 2.4.1 (64-bit)
>>> import google.protobuf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named protobuf
>>>

为什么会发生这个奇怪的错误?请帮我弄清楚。

【问题讨论】:

标签: python import ipython importerror protocol-buffers


【解决方案1】:

这可能是由于我的 anaconda protobuf 包和系统的 protobuf 之间存在一些冲突。卸载 protobuf 后 pip uninstall protobuf conda uninstall protobuf 并重新安装 conda install protobuf 现在一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-12
    • 1970-01-01
    • 1970-01-01
    • 2012-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多