루트 액세스가 없는 컴퓨터에 Theano를 설치하려고 하는데 LD_LIBRARY_PATH
Python 2.7을 설치하면 이 문제가 무시되는 것 같습니다. 시스템 수준에서 패키지를 설치할 수 없기 때문에 소스에서 모든 패키지(Python, SciPy, OpenBLAS 등)를 컴파일하여 $HOME에 설치하기로 결정했습니다. SciPy를 테스트할 때 오류가 발생 하지만 라이브러리가 존재하고 올바른 폴더를 가리키는 ERROR: Failure: ImportError (libopenblas.so.0: cannot open shared object file: No such file or directory)
것 같습니다 . LD_LIBRARY_PATH
전체 내용은 다음과 같습니다.
wheatstone-acogliat 42% echo $LD_LIBRARY_PATH
/home/seas/grad/acogliat/lib
wheatstone-acogliat 43% python -c "import scipy; scipy.test()"
Running unit tests for scipy
NumPy version 1.9.3
NumPy is installed in /home/seas/grad/acogliat/lib/python2.7/site-packages/numpy
SciPy version 0.16.0
SciPy is installed in /home/seas/grad/acogliat/lib/python2.7/site-packages/scipy
Python version 2.7.10 (default, Sep 28 2015, 21:06:05) [GCC 4.1.2 20080704 (Red Hat 4.1.2-55)]
nose version 1.3.7
/home/seas/grad/acogliat/lib/python2.7/site-packages/numpy/lib/utils.py:95: DeprecationWarning: `scipy.weave` is deprecated, use `weave` instead!
warnings.warn(depdoc, DeprecationWarning)
E.......................................................................K.......................................................................................................EEEEEEEEE.....................................................................................................EE......................................................................S...........EEE...........................................K......................................................................................................
======================================================================
ERROR: Failure: ImportError (libopenblas.so.0: cannot open shared object file: No such file or directory)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/seas/grad/acogliat/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/home/seas/grad/acogliat/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/seas/grad/acogliat/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/seas/grad/acogliat/lib/python2.7/site-packages/scipy/cluster/__init__.py", line 27, in <module>
from . import vq, hierarchy
File "/home/seas/grad/acogliat/lib/python2.7/site-packages/scipy/cluster/vq.py", line 89, in <module>
from . import _vq
ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory
[...MULTIPLE SIMILAR ERRORS OMITTED...]
FAILED (KNOWNFAIL=2, SKIP=1, errors=15)
wheatstone-acogliat 44% ls -al $LD_LIBRARY_PATH
total 47232
drwxr-sr-x 6 acogliat eestudent 512 Sep 28 22:58 ./
drwxr-sr-x 19 acogliat eestudent 512 Sep 28 23:29 ../
drwxr-sr-x 3 acogliat eestudent 512 Sep 28 22:58 cmake/
lrwxrwxrwx 1 acogliat eestudent 30 Sep 28 22:58 libopenblas.a -> libopenblas_opteronp-r0.2.14.a
-rw-r--r-- 1 acogliat eestudent 25211324 Sep 28 22:57 libopenblas_opteronp-r0.2.14.a
-rwxr-xr-x 1 acogliat eestudent 12826920 Sep 28 22:57 libopenblas_opteronp-r0.2.14.so*
lrwxrwxrwx 1 acogliat eestudent 31 Sep 28 22:58 libopenblas.so -> libopenblas_opteronp-r0.2.14.so*
lrwxrwxrwx 1 acogliat eestudent 31 Sep 28 22:58 libopenblas.so.0 -> libopenblas_opteronp-r0.2.14.so*
-r-xr-xr-x 1 acogliat eestudent 10193546 Sep 28 21:36 libpython2.7.a*
drwxr-sr-x 3 acogliat eestudent 512 Sep 28 22:46 perl5/
drwxr-sr-x 2 acogliat eestudent 512 Sep 28 21:36 pkgconfig/
drwxr-sr-x 28 acogliat eestudent 14336 Sep 28 21:36 python2.7/
wheatstone-acogliat 45% uname -a
Linux wheatstone 2.6.18-404.el5 #1 SMP Tue Apr 7 12:42:54 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
내가 무엇을 놓치고 있나요?
답변1
코드가 파일을 찾기 위해 명시적으로 호출하는 경우 일반 Python은 모듈과 라이브러리를 찾기 위해 dlopen()
LD_LIBRARY_PATH를 사용하지만 LD_LIBRARY_PATH를 사용합니다 . 배열을 $PYTHONPATH
설정할 수도 있습니다 .sys.path
import sys
sys.path.append('/mydir')
LD_LIBRARY_PATH 또는 PYTHONPATH를 내보내는 것을 잊지 마세요.