无法安装PyZMP for Python - Dependencies

时间:2014-04-02 15:07:31

标签: python pip homebrew zeromq pyzmq

我在安装iPython的PyZMP依赖项时遇到问题。我尝试过很多东西,例如使用pip / brew,但最后使用this answer手动安装包。

现在,pip list packages产生以下内容

pyzmq (14.2.0-dev)
pyzmq-static (2.2)

(我也尝试过使用pyzmq-static)。

另外,我的蟒蛇蛋明显存在于适当的位置:

ls /usr/local/lib/python2.7/site-packages/ | grep "pyzmq"
pyzmq-14.2.0_dev-py2.7.egg-info
pyzmq_static-2.2-py2.7.egg-info

此外:

which python
/usr/local/bin/python

echo $PYTHONPATH
/usr/local/lib/python:

然而,当我尝试导入

Python 2.7.6 (default, Mar 20 2014, 17:55:13)
In [1]: import pyzmq
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-2faa556e5dc0> in <module>()
----> 1 import pyzmq

ImportError: No module named pyzmq

任何有助于排除故障的帮助都会非常适用!

更新:我能够在python中列出zmq模块,但不能列出pyzmq模块:

>>help('modules zmq')

Here is a list of matching modules.  Enter any module name to get more help.

buildutils - utilities for building pyzmq.
buildutils.constants - script for generating files that involve repetitive 
            updates for zmq constants.
buildutils.detect - Detect zmq version
zmq - Python bindings for 0MQ.
...
zmqversion - A simply script to scrape zmq.h for the zeromq version.
IPython.consoleapp - A minimal application base mixin for all ZMQ based 
            IPython frontends.
IPython.html.base.zmqhandlers - Tornado handlers for WebSocket <-> ZMQ sockets.
...
IPython.utils.zmqrelated - Utilities for checking zmq versions.

2 个答案:

答案 0 :(得分:2)

你必须使用:

import zmq

而不是

import pyzmq

查看https://github.com/zeromq/pyzmq/blob/master/examples/

上的官方示例

答案 1 :(得分:1)

我也很难安装IPython(Jupyter),尤其是pyzmq依赖。最后,我找到了一种对我有用的方法(在Ubuntu中),麻烦少了很多:

$ sudo apt-get install libtool pkg-config build-essential autoconf automake python-dev 
$ sudo apt-get build-dep matplotlib 
$ sudo pip install matplotlib 
$ sudo pip install "ipython[all]"