加载模块时出现pyzmq错误

时间:2012-06-13 19:30:26

标签: zeromq pyzmq

我正在尝试安装pyzmq以在qtconsole模式下获取ipython wotking。

我已在默认位置(/ usr / local)安装了zeromq。动态库和标题都处于正确的位置。

我克隆了git repo for pyzmq并运行配置命令:

[root@XXXXX pyzmq]# python setup.py configure --zmq=/usr/local
running configure
************************************************
Configure: Autodetecting ZMQ settings...
Custom ZMQ dir:       /usr/local
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -Izmq/utils -Izmq/core -Izmq/devices -c detect/vers.c -o detect/vers.o
gcc -pthread detect/vers.o -L/usr/local/lib -Wl,-R/usr/local/lib -lzmq -o detect/vers
ZMQ version detected: 2.2.0
************************************************

到目前为止一切顺利。然后我运行安装命令:

[root@XXXXXX pyzmq]# python setup.py install
 running install
running build
running build_py
running build_ext
************************************************
Configure: Autodetecting ZMQ settings...
Custom ZMQ dir:       /usr/local
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -Izmq/utils -Izmq/core -Izmq/devices -c detect/vers.c -o detect/vers.o
gcc -pthread detect/vers.o -L/usr/local/lib -Wl,-R/usr/local/lib -lzmq -o detect/vers
    ZMQ version detected: 2.2.0
************************************************
skipping 'zmq/core/_poll.c' Cython extension (up-to-date)
skipping 'zmq/core/_version.c' Cython extension (up-to-date)
skipping 'zmq/core/constants.c' Cython extension (up-to-date)
skipping 'zmq/core/context.c' Cython extension (up-to-date)
skipping 'zmq/core/device.c' Cython extension (up-to-date)
skipping 'zmq/core/error.c' Cython extension (up-to-date)
skipping 'zmq/core/message.c' Cython extension (up-to-date)
skipping 'zmq/core/socket.c' Cython extension (up-to-date)
skipping 'zmq/core/stopwatch.c' Cython extension (up-to-date)
skipping 'zmq/utils/initthreads.c' Cython extension (up-to-date)
skipping 'zmq/utils/rebuffer.c' Cython extension (up-to-date)
skipping 'zmq/devices/monitoredqueue.c' Cython extension (up-to-date)
running install_lib
running install_egg_info
Writing /usr/lib64/python2.7/site-packages/pyzmq-2.2dev-py2.7.egg-info

然后我尝试在python中加载模块:

>>> import zmq

这有效(在setup.py命令中添加了--inplace之后)

但是当我启动ipython qtconsole时,我得到了这个错误(在其他几行之后):

import zmq
 File "/usr/lib64/python2.7/site-packages/zmq/__init__.py", line 29, in <module>
    from zmq import core, devices
  File "/usr/lib64/python2.7/site-packages/zmq/core/__init__.py", line 26, in <module>
    from zmq.core import (constants, error, message, context,
  File "message.pxd", line 39, in init zmq.core.poll (zmq/core/poll.c:2950)
ValueError: zmq.core.message.Message has the wrong size, try recompiling

知道这可能来自何处?

1 个答案:

答案 0 :(得分:0)

@akira - 可能是你从他们的github存储库中签出标记(v2.2.0)。这样做我看到了同样的问题。然后我从pypi下载了tar.gz for v2.2.0,它工作正常。