TL;DR:
conda install -yc nehaljwani python-igraph=0.7.1.post6
好的,让我们看看共享库存在哪些版本依赖:
readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBC_)([\d.]*)' | sort -Vr | head -1
2.14
readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBCXX_)([\d.]*)' | sort -Vr | head -1
3.4.15
让我们看看系统提供了什么:
strings /lib64/libc.so.6 | grep -Po '(?<=GLIBC_)([\d.]*)' | sort -Vr | head -1
2.12
strings /usr/lib64/libstdc++.so.6 | grep -Po '(?<=GLIBCXX_)([\d.]*)' | sort -Vr | head -1
3.4.13
如您所见,3.4.13 是 3.4.15 和 2.12 是 2.14,因此共享库 _igraph.so 不会加载。
好的,所以你有一些选择:
方案一:使用 conda 的 gcc 和 libxml2 build 构建包。
yum install -y gcc-c++ libxml2-devel
bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
conda install -y conda-build
conda install -yc marufr python-igraph=0.7.1.post6
conda install -y gcc libxml2
export LD_LIBRARY_PATH=~/m2/lib/
conda build $CONDA_PREFIX/pkgs/python-igraph-0.7.1.post6-py27_0/info/recipe/
conda remove -y python-igraph
conda install $CONDA_PREFIX/conda-bld/linux-64/python-igraph-0.7.1.post6-py27_0.tar.bz2
python -c 'import igraph; print igraph.__version__'
0.7.1
请注意,我使用了来自 conda 的 gcc,并且我必须设置 LD_LIBRARY_PATH,以便在测试包时,它会选择 $CONDA_PREFIX/lib/libstdc++.so 而不是系统的 libstdc++.so。因此,下次您使用自己构建的包时,您也必须使用 conda 安装 gcc。嗯,工作量太大了。
方案2:构建包,但使用系统的gcc和libxml2
yum install -y gcc-c++ libxml2-devel
bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
conda install -y conda-build
conda install -yc marufr python-igraph=0.7.1.post6
conda build $CONDA_PREFIX/pkgs/python-igraph-0.7.1.post6-py27_0/info/recipe/
conda remove -y python-igraph
conda install $CONDA_PREFIX/conda-bld/linux-64/python-igraph-0.7.1.post6-py27_0.tar.bz2
python -c 'import igraph; print igraph.__version__'
0.7.1
请注意,这一次,我不必导出LD_LIBRARY_PATH 并依赖旧的系统库。现在,您无需在每次使用此软件包时都使用 conda 安装 gcc。但是,工作量还是太大了,嗯。
方案3.让pip做共享库的编译:_igraph.so
yum install -y gcc-c++ libxml2-devel
bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
pip install python-igraph==0.7.1.post6
python -c 'import igraph; print igraph.__version__'
0.7.1
备选方案 4:我已经为您构建了软件包并将其放在我的频道上。随意使用它:-)
bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
conda install -yc nehaljwani python-igraph=0.7.1.post6
python -c 'import igraph; print igraph.__version__'
0.7.1
替代方案 4 是目前最简单的,但为什么它会起作用?现在让我们看看它的依赖关系:
readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBCXX_)([\d.]*)' | sort -Vr | head -1
3.4
readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBC_)([\d.]*)' | sort -Vr | head -1
2.7
如您所见,3.4 是 3.4.15 和 2.7 是 2.12,因此共享库 _igraph.so 现在加载系统的旧库:-)