Python 3.5.3 和 Oracle 11.2 on Windows 7:找不到 oracle 包含文件

Python 3.5.3 and Oracle 11.2 on Windows 7: cannot locate oracle include files

我刚刚安装了 Python 3.5.3,我还有一个 Oracle Client 目录,在 include 子目录中有很多 *.h 文件...

但是当我尝试

pip install cx_oracle

我得到:

distutils.errors.DistutilsSetupError: cannot locate Oracle include files in C:\oracle\instantclient_11_2

我对 Python 完全陌生,我 真的 想在 Web 应用程序中使用它(这将是我们第一次使用 Python 在我工作的公司),我当然需要你的帮助。

提前致谢!

您需要从 Oracle 安装依赖项。

  1. here

  2. 下载安装程序
  3. ORACLE_HOME添加为Windows环境变量并设置解压文件夹的路径,例如C:\....\Download\instantclient_12_1 作为它的值。如果您不知道如何添加环境变量,请单击here

  4. 将相同的路径附加到环境变量 Path

  5. pip install cx_oracle

  6. 重新启动计算机并开始使用 cx_oracle!

最后,感谢 Alex,我解决了我的问题。

我所做的是:

  1. here 下载 Windows 7 64 位 Instant Client BasicsInstall Client SDK
  2. 将所有内容放在同一个目录中 (C:\oracle\instantclient_12_1)
  3. 检查了我的系统 pathORACLE_HOME 变量。使用 echo %VARIABLE_NAME% 检查变量,然后使用 this procedure 设置它。 ORACLE_HOME 必须设置为 C:\oracle\instantclient_12_1(在我的情况下,您的可能不同)并且 PATH 必须包含相同的字符串。
  4. 前往 here 下载 Visual C++ Build Tools 2015,因为需要 C++
  5. 最后 pip install cx_oracle

确保您拥有 一切 32 或 64 位:安装客户端,Windows 版本,Python。

我运行Python 3.5.3,不知道目前有没有cx_oracle可以安装在Python 3.6.