为什么我不能在ubuntu 14.04 LTS上导入pyzmq?

Pen*_* He 2 python pyzmq

我已经安装了zmq和pyzmq.But我无法导入pyzmq.

>>> Successfully installed pyzmq
Cleaning up...
hepeng@hp:~$ python
enter code here
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyzmq
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pyzmq
Run Code Online (Sandbox Code Playgroud)

但我可以导入zmq.

>>> import zmq
>>> 
Run Code Online (Sandbox Code Playgroud)

那么为什么呢?谢谢.

Sha*_*ger 6

pyzmq是PyPI包安装程序名称,但实际的根包名称和导入为zmq.这就是一些Python包的工作方式; PyYAML是另一个例子,安装在名称下PyYAML,但导入为yaml.

如果你看一看的zmq文档pyzmqAPI,你会发现所有的Python示例import作为zmq.