How to fix cx_Oracle: DLL load failed?

2019-09-01 10:26发布

问题:

There are so many related questions that I have gone through which made me wonder how come this is such a prevalent issue? Anyways, I am trying to use cx_Oracle module.

I have the :

instant client: instantclient-basic-win32-11.1.0.6.0.zip 
python - 3.4
cx_Oracle - cx_Oracle-5.2-11g.win32-py3.4.exe 

I have set up Path as well as the ORACLE_HOME variables. Why is that I still get this error?

Edit: I tried installing cx_oracle again, but this time through install command on the setup.py instead of the .exe. I got an error distutils.errors.DistutilsSetupError: cannot locate Oracle include files in C:\oracle\client

C:\Oracle\Client is where my instant client resides that's where my path and Oracle_Home point to. Any idea how to overcome this problem?

回答1:

Well, I figured out how to fix it.

  1. The Oracle Instant Client version I had should be instantclient-basic-nt-11.2.0.4.0.zip
  2. Oracle Home is not needed at all
  3. When mentioning the path of instant client in the path variable, it should be the last if any other oracle client is already available in the machine.

Once I fixed these, it just worked like a charm!