如何在当前服务器上没有安装 Oracle 的情况下连接 Django 中的远程 Oracle 数据库?

How to connect remote Oracle database in Django without Oracle installation on current server?

我想用 Django 连接到 Oracle 数据库。它需要 cx_Oracle 模块。当我尝试安装 cx_Oracle 时,需要在当前服务器上安装 Oracle。

[root@localhost cx_Oracle-5.2]# /opt/python2.7/bin/python setup.py install
Traceback (most recent call last):
  File "setup.py", line 170, in <module>
    raise DistutilsSetupError("cannot locate an Oracle software " \
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation

但实际上我不需要在这台服务器上安装Oracle,我的Oracle 服务器是远程的。我该如何解决这个问题?

您需要安装Oracle Instant Client

cx_Oracle 使用它来连接到您的数据库。