2016-12-24 58 views
0

試圖運行使用cx_Oracle的腳本時,我得到一個ImportErrorcx_Oracle ImportError錯誤原因:找不到圖像

./runtests.py <args here> 

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: dlopen(/Users/smeatonj/Development/.virtualenvs/djangopy3/lib/python3.5/site-packages/cx_Oracle.cpython-35m-darwin.so, 2): Library not loaded: @rpath/libclntsh.dylib.12.1 
    Referenced from: /Users/smeatonj/Development/.virtualenvs/djangopy3/lib/python3.5/site-packages/cx_Oracle.cpython-35m-darwin.so 
    Reason: image not found 

其他建議建議出口LD_LIBRARY_PATH我已經做了。當我打開一個python shell並嘗試導入cx_Oracle時,它工作正常。

回答

0

的問題是,該腳本與前綴:

#!/usr/bin/env python 
import cx_Oracle 

我覺得這可以防止外殼使用LD_LIBRARY_PATH。解決方法是使用Python直接執行腳本:

python runtests.py 

我會很高興,如果有人知道更多編輯這個答案與其他信息LD_LIBRARY_PATH

相關問題