以下介绍在CentOS 7系统Python 3.7.1环境中安装pyzmq的正确方法。目前提供下载的pyzmq版本有17.1.2,但是直接安装可能会出现错误,会提示缺少库文件,比如下面的错误信息。
错误信息 gcc -pthread build/temp.linux-aarch64-3.7/scratch/tmp/timer_createv3ufssd_.o -o build/temp.linux-aarch64-3.7/scratch/a.out build/temp.linux-aarch64-3.7/scratch/tmp/timer_createv3ufssd_.o: In function `main': /tmp/timer_createv3ufssd_.c:2: undefined reference to `timer_create' collect2: error: ld returned 1 exit status gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -Izmq/utils -Izmq/backend/cython -Izmq/devices -c build/temp.linux-aarch64-3.7/scratch/vers.c -o build/temp.linux-aarch64-3.7/scratch/vers.o build/temp.linux-aarch64-3.7/scratch/vers.c:4:17: fatal error: zmq.h: No such file or directory #include "zmq.h" ^ compilation terminated. error: command 'gcc' failed with exit status 1 Failed with default libzmq, trying again with /usr/local {'libraries': ['zmq'], 'include_dirs': ['/usr/local/include'], 'library_dirs': ['/usr/local/lib'], 'runtime_library_dirs': ['/usr/local/lib'], 'extra_link_args': []}
解决方法 在CentOS 7系统终端中执行以下三段命令: sudo yum -y install zeromq-devel zeromq sudo yum -y install czmq-devel czmq pip3.7 install pyzmq 注:采用基于CentOS系列的Linux发行版碰到此类问题都可以采用本解决方法处理。
相关主题 |