CentOS 搭建Boost编译环境

1.建立swap

dd if=/dev/zero of=swapfile bs=2048 count=1024000

mkswap swapfile  

chmod 0600 swapfile

swapon swapfile 

2.增加sudo权限

/etc/suduers

# User privilege specification  
root        ALL=(ALL:ALL) ALL  
username    ALL=(ALL:ALL) ALL 

 

3.安装python mongodb相关

sudo yum -y install epel-release

sudo yum -y install python-pip

sudo python -m pip install --upgrade pip setuptools wheel

sudo python -m pip install numpy

sudo python -m pip install pymongo

sudo yum install gcc gcc-c++ bzip2 bzip2-devel bzip2-libs python-devel -y

sudo yum install -y gcc gcc-c++ make automake

sudo yum install cmake

sudo yum install libcurl openssl

4.编译安装boost

tar zxvf boost_1_69_0.tar.gz 

运行解压目录下bin内容

./bootstrap.sh --with-python=/usr/bin/python  //指定python

修改project-config.jam这个文件中python.configured部分

# Python configuration
import python ;
if ! [ python.configured ]
{
    using python : 2.7 : /usr : /usr/include/python2.7 : /usr/lib64/python2.7/site-packages ;
}

/usr  //python运行程序位置 

/usr/include/python2.7  //python头文件位置

/usr/lib64/python2.7/site-packages //python库文件位置

 

然后

./b2       //编译

./b2 install   //安装

 

5.增加boost_python 软连接

安装好boost后

BOOST_ROOT : /usr/local/include

BOOST_LIB: /usr/local/lib

编译会提示找不到boost_python库,是因为库文件名字不对
sudo ln -s libboost_python27.so libboost_python.so

 

 

 

 

你可能感兴趣的:(python,c++)