我在一個沒有權限的集羣上,我試圖登錄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
不會安裝一些依賴項。