1. http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
2. 기본으로는
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
이거만 깔면됨. linux에서 devel이 windows에선 sdk더라
나는 이것도 같이 깜
oracle-instantclient12.1-odbc-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-tools-12.1.0.2.0-1.x86_64.rpm
3. 자동으로 /usr/lib/oracle/버전명(나는12.1)/client64 에서 bin과 lib가 나옴
이제 환경변수 설정 ㄱㄱ
자기 home에서 (cd에서)
본인은 vi .bash_profile 함.
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export PATH=$ORACLE_HOME/bin:$PATH
입력함
저기서 PATH랑 DYLD_LIBRARY_PATH 는 빼도 되는거 같은데... 오류에 삽질하다보니 최종본이 저래됨
여튼 이렇게 하고
cx_Oracle tar 하나 구해서 압축 푼 곳으로 들어가면 setup.py가 있음
4. python setup.py build 하니
이런 오류가 났음
Traceback (most recent call last):
File "setup.py", line 135, in <module>
raise DistutilsSetupError("cannot locate an Oracle software " \
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
음.. 뭔소린지 모르겠다 검색 ㄱㄱ 하니 코드를 고치라함
자 그래서 고침
5. sudo vi setup.py
해서 123번줄로 가면(:set number ) 그 오류가 났던 raise 문이 나옴
굵은 곳을 고침.
# try to determine the Oracle home
#userOracleHome = os.environ.get("ORACLE_HOME")
userOracleHome = "/usr/lib/oracle/12.1/client64"
if userOracleHome is not None:
if not CheckOracleHome(userOracleHome):
messageFormat = "Oracle home (%s) does not refer to an " \
"9i, 10g, 11g or 12c installation."
raise DistutilsSetupError(messageFormat % userOracleHome)
else:
for path in os.environ["PATH"].split(os.pathsep):
if CheckOracleHome(path):
break
if oracleHome is None:
#raise DistutilsSetupError("cannot locate an Oracle software " \
# "installation")
oracleHome = "/usr/bin/oracle/12.1/client64"
무조건 path는 내가 만든 oracleHome으로
왠지 느낌이 될 것 같음
python setup.py build
python setup.py install
하면 뭐라뭐라 되고 드디어
python
후에
import cx_Oracle 하면 됨,.
나만 되나
원래 오류는 나만 안되는거임.
여튼 저장해둠