简体   繁体   English

cx_oracle 5.2.1 setup.py如何自动找到其构建依赖项?

[英]How does cx_oracle 5.2.1 setup.py automatically find its build dependencies?

I downloaded cx_oracle 5.2.1 and started building : 我下载了cx_oracle 5.2.1并开始构建:

  python setup.py build

I noticed that it found build dependencies within my system without any specification from me. 我注意到它在我的系统中发现了构建依赖项,而没有提供任何规范。 I would like to better understand how it did that. 我想更好地了解它是如何做到的。 The contents in setup.py does not indicate any such information. setup.py中的内容并不表示任何此类信息。

I don't have the source of cx_Oracle's setup.py in front of me right now, but in the BUILD.txt file included with it, it mentions use of some environment variables: 我现在现在还没有cx_Oracle的setup.py的源代码,但是在其中包含的BUILD.txt文件中,它提到了一些环境变量的使用:

It is necessary to set environment variables ORACLE_HOME and LD_LIBRARY_PATH inside $HOME/.profile in order for cx_Oracle to import properly after installation and in order to build correctly. 必须在$ HOME / .profile中设置环境变量ORACLE_HOME和LD_LIBRARY_PATH,以便cx_Oracle在安装后正确导入并正确构建。 Using a text editor add the settings below to $HOME/.profile making sure to change the location of your actual installation path. 使用文本编辑器将以下设置添加到$ HOME / .profile中,以确保更改实际安装路径的位置。

 Example ($HOME/.profile): ------------------------- export ORACLE_HOME=[your installation path]/instantclient_11_1 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME 

This from the section for Linux hints, as I recall I had to set the same things up to build it under Windows. 在Linux提示部分中,这是一个提示,正如我记得的那样,必须在Windows下进行相同的设置来构建它。

As for how it finds more standard libraries. 至于如何找到更多的标准库。 I think that's part of the magic of the distutils module. 我认为这是distutils模块不可思议的一部分。 Under unix distutils seems to generally just work so long as the required libraries and headers have been installed through your unix's standard packaging mechanism. 在Unix下,只要通过unix的标准打包机制安装了所需的库和头文件,distutils似乎通常就可以工作。 This is probably due to the fact that unix has better standardized ways of locating build resources (than for example Windows does). 这可能是由于unix具有更好的标准化构建资源定位方式的事实(例如Windows所不具备)。

I know when I'm forced to compile Python packages under Windows, I often have to explicitly tell it where to find header files and libraries. 我知道当我被迫在Windows下编译Python软件包时,我经常不得不明确地告诉它在哪里可以找到头文件和库。 After having had to go out and find said libraries and compile them manually. 在不得不走出去找到所述库并手动编译它们之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM