標籤:blog http io ar os sp for on 檔案
前幾個步驟可參考這篇文章: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錯誤解決辦法