使用Cygwin安装pzmq

2024-04-29 09:36:09 发布

您现在位置:Python中文网/ 问答频道 /正文

两天来,我一直在努力安装pyzmq,我真的不知道是什么问题。在

之后收到的错误消息:

pip install pyzmq

是:

^{pr2}$

我安装了gcc。在

which gcc
/usr/bin/gcc

Python安装在同一位置。我真的在努力寻找解决办法。在

编辑:添加到错误的输出中,以下是进一步描述错误的输出:

 bundled/zeromq/src/signaler.cpp:62:25: fatal error: sys/eventfd.h: No  such file or directory
  #include <sys/eventfd.h>
                         ^
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip- build-INbMj2/pyzmq/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), 
__file__, 'exec'))" install --record /tmp/pip-n8hQ_h-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-INbMj2/pyzmq

编辑二:遵循https://github.com/zeromq/pyzmq/issues/391中的安装说明

pip install pyzmq --install-option="fetch_libzmq"

产量:

#include <sys/eventfd.h>
                         ^
compilation terminated.
error: command 'gcc' failed with exit status 1

下一步:

pip install --no-use-wheel pyzmq --global-option='fetch_libzmq' --install-option='--zmq=bundled'

产量:

#include <sys/eventfd.h>
                         ^
compilation terminated.
error: command 'gcc' failed with exit status 1

Tags: installpipinclude错误withsyserrorpyzmq
3条回答

python3zmq是cygwin中的一个包。假设您正在尝试安装Python3,如果您使用的是apt cyg package manager,那么可以使用

apt-cyg install python3-zmq

我自己也遇到了这个问题。经过大量研究,得出以下结论:

cygwin不支持eventfd功能。如果您签入/usr/include/sys,您会注意到eventfd.h不存在。我不知道为什么cygwin不支持这个——但是我找到了https://cygwin.com/ml/cygwin/2012-10/msg00198.html它暗示了很多,而且还有丢失的头文件,我的结论是在添加之前我们是SOL。在

下面是glibc的github repo,其中包含eventfd.h: https://github.com/lattera/glibc/tree/a2f34833b1042d5d8eeb263b4cf4caaea138c4ad/sysdeps/unix/sysv/linux/sys

下面是cygwin中包含的核心devel文件的列表(注意eventfd是缺少的文件之一): https://cygwin.com/cgi-bin2/package-grep.cgi?grep=cygwin-devel&arch=x86

顺便说一句——如果你想安装ipython笔记本(这就是我遇到这个错误的原因),作为一种解决方法,我使用了瓦卡里.io它为ipython笔记本提供了一个web接口。在

用pip在Cygwin中安装IPython很痛苦,但并非不可能。@ahmadia对zeromqgithub项目的评论给出了安装pyzmq:https://github.com/zeromq/pyzmq/issues/113#issuecomment-25192831

评论说这是为64位Cygwin设计的,但我在32位上的操作说明很好。我将总结一下假设安装到/usr/local的步骤。首先下载并提取zeromq和pyzmq的tarball。然后:

# in zeromq directory
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
./configure --without-libsodium
make
gcc -shared -o cygzmq.dll -Wl,--out-implib=libzmq.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive src/.libs/libzmq.a -Wl,--no-whole-archive -lstdc++
install include/zmq.h  /usr/local/include
install include/zmq_utils.h  /usr/local/include
install cygzmq.dll /usr/local/bin
install libzmq.dll.a /usr/local/lib

# in pyzmq directory
python setup.py build_ext --zmq=/usr/local --inplace
python setup.py install --zmq=/usr/local --prefix=/usr/local

# finally!
pip install ipython[all]

之后,pip install ipython[all]就可以了,包括笔记本。在

相关问题 更多 >