2017-01-06 75 views
0

我在一个没有权限的集群上,我试图登录pip install mpi4py。由于我无法安装python3-devel包,因此我将其下载并放入~/.local/。不管这是否有成功的可能性,以下都让我感到困惑。如何在安装pip软件包时添加header include dirs?

如果我只需运行pip3.4 install --user mpi4py,我遇到了这个错误:

/opt/sgi/mpt/mpt-2.14/bin/mpicc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -DHAVE_CONFIG_H=1 -DHAVE_DLFCN_H=1 -DHAVE_DLOPEN=1 -I~/.local/include/python3.4m/ -I/usr/include/python3.4m -c src/MPI.c -o build/temp.linux-x86_64-3.4/src/MPI.o 
In file included from src/MPI.c:4:0: 
src/mpi4py.MPI.c:4:20: fatal error: Python.h: No such file or directory 
#include "Python.h" 

所以我想我需要告知pip这个头的位置。我试图去与

pip3.4 install --user --global-option=build_ext --global-option="-I~/.local/include/python3.4m/" mpi4py 

但我仍然收到相同的错误(??)。我也尝试在没有全局选项的情况下将CPATH=$CPATH:~/.local/include/python3.4m加上前缀,但无济于事。

pip怎么简单忽略包含路径?

服务器是某种Suse Linux Enterprise。

更新:我原来的路径必须是绝对的,但在链接阶段出现同样的问题:

ls ~/.local/lib64/ 
libpython3.4m.so libpython3.so pkgconfig 

所以我添加--global-option="-L$HOME/.local/lib64/"pip命令,然后这样的:

/opt/sgi/mpt/mpt-2.14/bin/mpicc -pthread _configtest.o -L/home/student/n/name/.local/lib64/ -Lbuild/temp.linux-x86_64-3.4 -lpython3.4m -o _configtest 
    /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lpython3.4m 
    collect2: error: ld returned 1 exit status 
    failure. 
    removing: _configtest.c _configtest.o 
    error: Cannot link MPI programs. Check your configuration!!! 

    ---------------------------------------- 

因此,库路径被添加,-l<libname>匹配,但它不链接。看来,libpython3.4m.so实际上是我无法找到的libpython3.4m.so.1.0的符号链接。也许这是问题,因为我的手动安装python3-devel不会安装一些依赖项。

回答

0

事实证明,作为全局选项传递的路径必须是绝对路径,所以~必须由主目录的完整路径替换。

但是,第二个问题出现了,因为libpython3.4m.so实际上是一个符号链接,并且原始文件不包含在我手动安装的rpm包python3-devel中。因此有必要获得libpython3.4m.so.1.0的形式,例如, https://rpmfind.net/linux/rpm2html/search.php?query=libpython3.4m.so.1.0()(64bit)并将其放置在与链接相同的目录中。

相关问题