【问题标题】:Python and oracle 32bit and 64bit instaclient on same machine同一台机器上的 Python 和 oracle 32 位和 64 位 instaclient
【发布时间】:2015-09-15 06:21:03
【问题描述】:
我在一台机器上同时拥有 wamp 和 python。由于非常特殊的原因,PHP 需要使用 64 位版本的 oracles instaclient,而 python 需要使用 32 位版本。我的 Path 变量指向 64 位版本。这显然对我的 32 位 Python 没有好处。
有没有办法可以让 python cx_oracle 专门查看 32 位版本的 Instantclient。
【问题讨论】:
标签:
python-2.7
cx-oracle
instantclient
【解决方案1】:
您可以通过正确设置环境变量来启动您的脚本。例如,如果您像这样从命令行运行脚本并设置环境变量,它应该可以按预期工作。不要忘记从 %path% 中删除 64 位即时客户端路径,我只是以此为例。只需将路径添加为分号分隔,或者您可以创建一个 python 脚本删除/更改环境变量并启动您的应用程序。
C:\Windows\System32\cmd.exe /c "set ORACLE_HOME=D:\oracle && PATH=%path% && yourscript.py"
您的第二个选择是将即时客户端文件复制到您的应用程序工作目录。