如何手动安装cx_Oracle rpm?

时间:2013-02-15 11:47:32

标签: python linux install rpm

我没有root权限。我已下载cx_Oracle-5.1.2-10g-py26-1.i386.rpm,我想安装它。如何在没有root权限的情况下安装它?

2 个答案:

答案 0 :(得分:3)

嗯,有两种可能性:

  1. 安装rpm而不是root:http://ajaya.name/?p=6353
  2. 下载源并在任意位置安装(源代码可在以下位置找到:http://cx-oracle.sourceforge.net/(仅限源代码)
  3. 如果您已编译了某些内容,我建议使用2选项

答案 1 :(得分:3)

现在开始:我已安装在/home/spatel/cx

[spatel@us04 ~]$ rpm -ivh --root /home/spatel/cx cx_Oracle-5.1-11g-py32-1.i386.rpm --relocate /usr=/home/spatel/cx
Preparing...                ########################################### [100%]
   1:cx_Oracle              ########################################### [100%]

以下是我的模块:

[spatel@us04 ~]$ ls -l ~/cx/lib/python3.2/site-packages/
total 276
-rw-r--r-- 1 spatel spatel    896 Mar 19  2011 cx_Oracle-5.1-py3.2.egg-info
-rwxr-xr-x 1 spatel spatel 273264 Mar 19  2011 cx_Oracle.cpython-32mu.so

设置你的python路径

>>> import sys
>>> sys.path.append("/home/spatel/cx/lib/python3.2/site-packages")
>>> print (sys.path)
['', '/usr/lib64/python24.zip', '/usr/lib64/python2.4', '/usr/lib64/python2.4/plat-linux2', '/usr/lib64/python2.4/lib-tk', '/usr/lib64/python2.4/lib-dynload', '/usr/lib64/python2.4/site-packages', '/usr/lib64/python2.4/site-packages/gtk-2.0', '/usr/lib/python2.4/site-packages', '/home/spatel/cx/lib/python3.2/site-packages']