2017-08-10 151 views
1

,我使用的教程如下: https://heasarc.gsfc.nasa.gov/xanadu/xspec/python/html/buildinstall.html無法導入xspec在Python

我已經完成安裝,直到..Once HEASOFT is finished building and installing, you should find PyXspec’s code files and lib_pyXspec.so library in the directory $HEADAS/lib/python/xspec.

然而,當我運行$HEADAS/headas-init.csh,它要求超級用戶權限,當我使用sudo,它給我一個錯誤,說沒有找到命令。然後我嘗試手動設置PYTHONPATH環境:

>>> sys.path 
['', '/usr/local/lib/python2.7/dist-packages/pyds9-1.9.dev0-py2.7-linux-x86_64.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] 
>>> 
>>> sys.path.append("$HEADAS/lib/python") 
>>> import xspec 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "xspec/__init__.py", line 66, in <module> 
    from .chain import ChainManager, AllChains, Chain 
    File "xspec/chain.py", line 4, in <module> 
    from . import _pyXspec 
ImportError: libXSUser.so: cannot open shared object file: No such file or directory 

但是這也沒有效果。我該如何安裝?

謝謝

+0

如果您在輸入端「這蟒蛇」的輸出是什麼? –

回答

0

從我讀什麼,它看起來像sys.path中的方式進行搜索,可能是一個問題。
兩個最相關的帖子中,我能找到的事情是這些:

http://askubuntu.com/questions/593333

Why can't Python find shared objects that are in directories in sys.path?

+0

我從終端運行'$ LD_LIBRARY_PATH'(正如這裏的帖子所建議的:https://stackoverflow.com/a/1100016/3243703),但它表示變量未定義。所以,我執行了'env | grep'^ LD_LIBRARY_PATH'',它沒有輸出。這是否意味着變量是空的,我需要使用以下命令來添加路徑:'export LD_LIBRARY_PATH =/usr/local/lib:$ LD_LIBRARY_PATH'? –

+0

這就是我會嘗試的,但我不是專家,誠然。只是想嘗試把你引向正確的方向。 –