boost编译libboost_python3

linux系统自带python2.7,boost编译后会生成libboost_python27.so,但有些应用需要libboost_python3,下面我们就来编译。

进入boost源文件目录boost_1_67_0,配置仅仅编译python,python路径指向anaconda3中的python3.6。

./bootstrap --with-libraries=python --with-toolset=gcc
./b2 --with-python include="/qp/3rd/anaconda3/include/python3.6m/"
sudo ./b2 install

编译安装成功后,/usr/local/lib下会有libboost_python36.so和libboost_python36.a,有些应用link时需要的是libboost_python3.so或者libboost_python3.a,我们建个软链:

cd /usr/local/lib
sudo ln -s libboost_python-py36.so libboost_python3.so
sudo ln -s libboost_python-py36.a libboost_python3.a
大功告成!

猜你喜欢

转载自blog.csdn.net/bodybo/article/details/79962814