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

后端 未结 8 1736
耶瑟儿~
耶瑟儿~ 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:57

    For me the problem was that I had installed cx_Oracle via DOS pip which changed it to lower case. Installing it through Git Bash instead kept the mixed case.

    0 讨论(0)
  • 2020-12-15 11:02

    I have just faced the same problem. First, you need to install the appropriate Oracle client for your OS. In my case, to install it on Ubuntu x64 I have followed this instructions https://help.ubuntu.com/community/Oracle%20Instant%20Client#Install_RPMs

    Then, you need to install cx_Oracle, a Python module to connect to the Oracle client. Again, assuming you are running Ubuntu in a 64bit machine, you should type in a shell:

    wget -c http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-5.0.4-11g-unicode-py27-1.x86_64.rpm
    sudo alien -i cx_Oracle-5.0.4-11g-unicode-py27-1.x86_64.rpm
    

    This will work for Oracle 11g if you have installed Python 2.7.x, but you can download a different cx_Oracle version in http://cx-oracle.sourceforge.net/ To check which Python version do you have, type in a terminal:

    python -V
    

    I hope it helps

    0 讨论(0)
提交回复
热议问题