Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown

后端 未结 8 1863
耶瑟儿~
耶瑟儿~ 2020-12-15 10:33

I try to write a script in .py for oracle connectivity:

#!/usr/bin/python

import cx_Oracle

connstr=\'username/pwd@database\'
conn = cx_Oracle.connect(conns         


        
8条回答
  •  感动是毒
    2020-12-15 10:46

    Windows help:

    1. Get the instant client from here.
    2. Put the directory into your PATH variable.
    3. Go to the command prompt (Win+R and type cmd) and set 2 variables matching your location- for example:

      set TNS_ADMIN=C:\instant_client\instantclient_11_2 set ORACLE_HOME=C:\instant_client\instantclient_11_2

    Then install the cx_Oracle module from an exe. If you use pip or easy_install, ...good luck.

    You can get the installer here: https://pypi.python.org/pypi/cx_Oracle/5.1.3

提交回复
热议问题