I tried a lot of ways to finally solve the problem. Since I think I should write a comprehensive answer, I will write the problems that I faced and their solutions respectively; hoping it can help others. I also changed the question's name to an appropriate one. Here's what I've been through during installation of cx_Oracle
module in Windows 7 - 32 bit version(I think other versions of windows would have similar solutions, but I'm not sure):
I have tried to install
cx_Oracle
usingeasy_install
and I got the errorNo oracle client installed
. I have downloaded oracle basic instant client and oracle sdk instant client for windows from Oracle Official Website and installed it via following steps:Unzip oracle basic instant client into directory
C:\oracle\instant_client_11_1\
.Unzip oracle sdk instant client and copy folder
sdk
into the directoryC:\oracle\instant_client_11_1\
, consequently we have a directory asC:\oracle\instant_client_11_1\sdk\
.Add
C:\oracle\instant_client_11_1\
to the end of thePATH
environment variable.Add a new variable named
ORACLE_HOME
and setC:\oracle\instant_client_11_1\
for the value.Restart computer.
I tried to install
cx_Oracle
usingeasy_install
again and I got errorcommand ‘gcc’ failed: no such file or directory
and in some casesunable to find vcvarsall.bat
; this was because I didn’t have a C++ compiler, so I followed these steps to solve it:Download Microsoft Visual C++ and install it.
Download MinGW and install it; note that you must install GCC module.
Add
C:\MinGW\
andC:\MinGW\bin\
(which containsgcc.exe
) to the end of thePATH
environment variable.I tried to install
cx_Oracle
usingeasy_install
again and I got errorcommand ‘gcc’ failed with exit status 1
; I tried this step to solve it:Open file
C:\Python27\Lib\distutils\ cygwincompiler.py
and remove all–mno-cygwin
occurrences in this file; this is because recent versions ofGCC
has removed–mno-cygwin
option and it shouldn’t be there.I tried to install
cx_Oracle
usingeasy_install
and it worked.
But during searching in the internet I found a couple of tricks that may be useful:
If you got error
no module named win32api
, it’s because you didn’t install win32 extensions of python on your computer you should downloadpywin32
module from Source Forge and install it.If you didn’t succeed anyway, you can try an older version of
cx_Oracle
; but keep in mind all we talked about in the above lines. You can find all versions ofcx_Oracle
here.If you want to use
sqlplus
you should do some other steps too. For this purpose search the internet.