我最近一直在开发一个项目,该项目主持一个关于cherrypy的Web门户,其中一个功能是它将从许多不同的表单中提取所有用户,然后将这些值发送回oracle DB。我已经能够在我的Windows笔记本电脑和RHEL开发盒上本地轻松设置我的测试环境。问题是,在那些我有root / admin访问权限的位置。
但是目前我正在努力将其推向非开发盒,因此需要让unix管理员参与实际必要的安装等。
出现的第一个错误是缺少的Python.h文件,无论是通过pip完成还是使用python setup.py build
和python setup.py install
构建源代码,cx_Oracle模块的构建都将失败。我很快意识到这一点,因为我们没有安装必要的python-devel软件包,一旦管理员运行yum install python-devel.x86_64
命令,必要的文件到位,使其在安装过程中至少进一步。
在完成之后我尝试再次通过pip和源代码构建,但是有一个关于oci.h文件丢失的类似错误。然后我注意到我的用户没有设置正确的LD_LIBRARY_PATH或ORACLE_HOME路径,所以我将它们设置为如下面的回声中所示
-bash-4.2$ echo $LD_LIBRARY_PATH
usr/lib/oracle/12.2/client64/lib:/usr/include/oracle/12.2/client64/
-bash-4.2$ echo $ORACLE_HOME
usr/lib/oracle/12.2/client64
这删除了oci.h文件错误,但是在通过pip
安装时遇到了这个错误distutils.errors.DistutilsSetupError: Oracle home (usr/lib/oracle/12.2/client64) does not refer to an 10g, 11g or 12c installation.
尝试从源代码构建时出现此错误我收到有关无法写入某个位置的错误。
-bash-4.2$ python setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/lib64/python2.7/site-packages/test-
easy-install-15850.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/lib64/python2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again.
鉴于我可以确认看到我认为$ ORACLE_HOME / bin,$ ORACLE_HOME / lib和/usr/include/oracle/12.2/client64中的所有必要文件,我将如何验证它是否是有效的安装Oracle Instant Client?
或者我最好在源代码试图构建的site-packages位置请求写入权限?
最后的笔记
Oracle home (usr/lib/oracle/12.2/client64) does not refer to an 10g, 11g or 12c installation.
.local/bin/pip install cx_Oracle
或任何包名称yum info oracle-instantclient12.2-basic
和yum info oracle-instantclient12.2-devel
都显示已安装总的来说,这次安装cx_Oracle有点失落,因为我之前有root / admin访问权限,但是这个盒子我不会。