centos7 下编译nanomsg

nanomsg 在python下使用起来非常方便。而且还能直接和利用mangos(nanomsg的go语言实现)库编写的并发非阻塞的消息中心交互。

python下可以直接使用pip install nanomsg来安装nanomsg,但安装完成后无法直接使用,必须安装相应的libnanomsg.so。如果是debian系统(debian,Ubuntu 等基于debian的发行版)可以直接通过apt-get安装,但centos下搜索不到相应的lib(yum search nanomsg),因此只能根据官方的readme自己编译。

以下是编译的命令:

wget https://github.com/nanomsg/nanomsg/archive/1.1.2.tar.gz
tar -zxvf 1.1.2.tar.gz
cd nanomsg-1.1.2/
mkdir bulid
yum install gcc gcc-c++ python-devel cmake
cd bulid/
cmake ..
cmake --build . --config Debug
ctest -C Debug .
cmake --build . --target install
echo "/usr/local/lib64" >> /etc/ld.so.conf
ldconfig

验证:

pip install -U nanomsg
python -c "import nanomsg"

不报错说明编译得没问题

猜你喜欢

转载自my.oschina.net/u/3703365/blog/1589190