首页 > 代码库 > mac安装cx_Oracle 出现cannot locate an Oracle software错误解决办法

mac安装cx_Oracle 出现cannot locate an Oracle software错误解决办法

前几个步骤可参考这篇文章:http://www.cs.utexas.edu/~mitra/csSpring2011/cs327/cx_mac.html

 

在进行到sudo python setup.py build 以及install的时候

明明echo $ORACLE_HOME等这些环境变量都设置的,但还是报找不到ORACLE HOME的错误,错误如下:

userdeMacBook-Pro:cx_Oracle-5.1.2 mac$ sudo python setup.py buildPassword:Traceback (most recent call last):  File "setup.py", line 132, in <module>    raise DistutilsSetupError("cannot locate an Oracle software " distutils.errors.DistutilsSetupError: cannot locate an Oracle software installationuserdeMacBook-Pro:cx_Oracle-5.1.2 mac$ sudo echo $ORACLE_HOME/Users/mac/oracle/instantclient_11_2

 根据提示找到setup.py文件的132行,写的是

119 120 # try to determine the Oracle home121 #userOracleHome = os.environ.get("ORACLE_HOME")122 userOracleHome="/Users/mac/oracle/instantclient_11_2"123 if userOracleHome is not None:124     if not CheckOracleHome(userOracleHome):125         messageFormat = "Oracle home (%s) does not refer to an " 126                 "9i, 10g or 11g installation."127         raise DistutilsSetupError(messageFormat % userOracleHome)128 else:129     for path in os.environ["PATH"].split(os.pathsep):130         if CheckOracleHome(path):131             break132     if oracleHome is None:133         raise DistutilsSetupError("cannot locate an Oracle software " 134                 "installation")

 找不到目录就打出异常,程序退出,我这里在122行给他这个目录强行写死了(确保该目录的确存在)

然后在执行安装,程序顺利通过。

mac安装cx_Oracle 出现cannot locate an Oracle software错误解决办法