鉴于不是root用户,为了安装boost.python真的废了老命了,特此记录安装过程
一、下载解压以及准备
下载boost压缩包:boost_1_70_0.tar.gz,并解压
tar -xvf boost_1_70_0.tar.gz
为了安装boost.python,需要要include“pyconfig.h”,所以一定要在你的python下找到这个文件所在位置,并添加到环境变量里
export CPLUS_INCLUDE_PATH=/your-path/envs/r0.3.0/include/python3.6m:$CPLUS_INCLUDE_PATH
不然会报错: fatal error: pyconfig.h: 没有那个文件或目录
二、安装
因为我不能保存在 /user/local下,所以我要自己设置一个安装bosst的目录,--prefix=/your/boost/path
我用的是环境里安的python,所以先进入环境(Anaconda)后进入解压目录:
cd boost_1_70_0
然后输入:
./bootstrap.sh --with-python=/your_path/envs/r0.3.0/bin/python3.6 --with-python-root=/your_path/envs/r0.3.0/lib/python3.6 --prefix=/your/boost/path
显示如下成功:(我不需要mpi++)
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 3.6
Unicode/ICU support for Boost.Regex?... /usr
Generating Boost.Build configuration in project-config.jam for gcc...
Bootstrapping is done. To build, run:
./b2
To generate header files, run:
./b2 headers
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/build/
然后输入:
./b2 install -a --with=all
--with=all是安装boost所有库,过了很久以后显示:
...updated 16664 targets...
就安装好了!(没有failed,之前装了好几次都有failed)