Che*_*Xie 10 python oracle cx-oracle module
我最近在我的机器上安装了cx_Oracle模块,以便连接到远程Oracle数据库服务器.(我身边没有Oracle客户端).
然后每次我运行我的脚本时,它都会失败并打印以下消息:
ImportError:DLL加载失败:找不到指定的模块.
我在Here找到了一个相关的帖子,所以我想知道我是否必须在我这边调用python脚本的Oracle客户端.
谁能帮我吗?提前致谢.
Kas*_*yap 11
# - This import requires appropriate oraocciXX.dll to be available in PATH (on windows)
# (Probably LD_LIBRARY_PATH or LD_LIBRARY_PATH64 on POSIX)
# where XX is the oracle DB version, e.g. oraocci11.dll for Oracle 11g.
# - This dll is part of the Oracle Instant client pkg available here:
# http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
# - Also ensure that python, cx_Oracle and Oracle Client are of same arch (32 or 64-bit)
#
import cx_Oracle
Run Code Online (Sandbox Code Playgroud)
你可以找到arch(32或64位):
dumpbin /headers oraocciXX.dllfile oraocciXX.so最后,如果你仍然不明白这里真的是假人的指示:
C:\ProgFiles\OraClient\11_2set PATH=%PATH%;C:\ProgFiles\OraClient\11_2export LD_LIBRARY_PATH=/path/to/your/32bit/oraocciXX.soexport LD_LIBRARY_PATH64=/path/to/your/64bit/oraocciXX.sopath-to-python/python.exe -c "import cx_Oracle"以测试您的设置是否正常工作.
ImportError: DLL load failed: The specified module could not be found:然后找不到oraocciXX.正确设置env vars.ImportError: DLL load failed: %1 is not a valid Win32 application:您有32/64位不匹配.是的,您必须安装Oracle客户端.
"请注意,为了使用cx_Oracle,需要安装Oracle客户端(或服务器).如果您不需要安装完整客户端的工具,建议安装更容易安装的Instant Client. "
编辑链接到Instant Client:http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html