nanomsg 在python下使用起来很是方便。并且还能直接和利用mangos(nanomsg的go语言实现)库编写的并发非阻塞的消息中心交互。python
python下能够直接使用pip install nanomsg来安装nanomsg,但安装完成后没法直接使用,必须安装相应的libnanomsg.so。若是是debian系统(debian,Ubuntu 等基于debian的发行版)能够直接经过apt-get安装,但centos下搜索不到相应的lib(yum search nanomsg),所以只能根据官方的readme本身编译。c++
如下是编译的命令:git
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
ldconfiggithub
验证:centos
pip install -U nanomsg
python -c "import nanomsg"并发
不报错说明编译得没问题ui