저항하는 것

Python에서 cx_Oracle 에러(DPI-1047) 해결하기 본문

컴퓨터

Python에서 cx_Oracle 에러(DPI-1047) 해결하기

0fec 2025. 2. 18. 15:01
728x90

Python에서 cx_Oracle 패키지를 불러왔을 때, Mac Silicon (ARM64) 기준 아래와 같은 메시지가 발생시 대처 방법입니다.

cx_Oracle.DatabaseError: DPI-1047:
Cannot locate a 64-bit Oracle Client library:
"dlopen(libclntsh.dylib, 0x0001): tried: 'libclntsh.dylib' (no such file), (하략)

Oracle Client (ARM64)로 설치했음에도 이같은 오류가 뜨면 아래와 같은 코드를 입력합니다.
(출처: https://stackoverflow.com/questions/69165050/python-dpi-1047-cannot-locate-dlopenlibclntsh-dylib-on-macos)

import cx_Oracle

import platform # set oracle client path
if platform.system() == "Darwin":
    cx_Oracle.init_oracle_client(lib_dir=os.environ.get("HOME")+"/instantclient_[버전명]")

여기서 instantclient_[버전명]은 Oracle Client의 버전명입니다. (예: instantclient_23_3)
Oracle Client가 설치된 경로에 맞추어 지정합니다. (Downloads나 Home 폴더 등)

 

추신) Alpha-Traveler, Baundy와 같은 조회수 유도 계정은 댓글 달면 차단합니다.

Comments