Domanda

I am using Python 2.7 (32bit) and my OS is 64 bit Windows 7.

I am trying to install cx_Oracle module. I have run the msi "cx_Oracle-5.1.2-10g.win32-py2.7.msi", and then I ran "easy_install cx_Oracle" on the cmd line and got the message:

error: Unable to find vcvarsall.bat

I found on this site that the best solution is to install Microsoft Visual Studio 2008, which I did from a link I found on this site.

Now when I run "easy_install cx_Oracle" on the cmd line I get the following message, which I don't know what it means:

C:\Python27>easy_install cx_Oracle Searching for cx-Oracle Reading ....org/simple/cx_Oracle/ Reading ....net/crew/atuining Reading ...sourceforge.net Best match: cx-Oracle 5.1.2 Downloading http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-5.1.2.tar.gz? download Processing cx_Oracle-5.1.2.tar.gz Writing c:\users\cnielsen\appdata\local\temp\easy_install-44rupd\cx_Oracle-5.1.2 \setup.cfg Running cx_Oracle-5.1.2\setup.py -q bdist_egg --dist-dir c:\users\cnielsen\appda ta\local\temp\easy_install-44rupd\cx_Oracle-5.1.2\egg-dist-tmp-eyihnb Traceback (most recent call last): File "C:\Python27\Scripts\easy_install-script.py", line 9, in load_entry_point('setuptools==0.8', 'console_scripts', 'easy_install')() File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1992 , in main File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1979 , in with_ei_usage File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1996 , in File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 380, in run File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 623, in easy_install File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 653, in install_item File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 849, in install_eggs File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1130 , in build_and_install File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1115 , in run_setup File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 69, in run_setup File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 120, in run File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 71, in File "setup.py", line 350, in File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "build\bdist.win-amd64\egg\setuptools\command\bdist_egg.py", line 185, in run File "build\bdist.win-amd64\egg\setuptools\command\bdist_egg.py", line 171, in call_command File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command self.distribution.run_command(command) File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "build\bdist.win-amd64\egg\setuptools\command\install_lib.py", line 20, i n run File "C:\Python27\lib\distutils\command\install_lib.py", line 111, in build self.run_command('build_ext') File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command self.distribution.run_command(command) File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "build\bdist.win-amd64\egg\setuptools\command\build_ext.py", line 52, in run File "C:\Python27\lib\distutils\command\build_ext.py", line 339, in run self.build_extensions() File "C:\Python27\lib\distutils\command\build_ext.py", line 448, in build_exte nsions self.build_extension(ext) File "build\bdist.win-amd64\egg\setuptools\command\build_ext.py", line 186, in build_extension File "C:\Python27\lib\distutils\command\build_ext.py", line 498, in build_exte nsion depends=ext.depends) File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compile self.initialize() File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize vc_env = query_vcvarsall(VERSION, plat_spec) File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in query_vcvarsal l raise ValueError(str(list(result.keys()))) ValueError: [u'path']

È stato utile?

Soluzione 5

I finally solved the problem after 3 days of searching.

The trick was to:

  1. Install vcredist_x86.exe. After installing this, I ran easy_install cx_Oracle and no longer saw the original error message.
  2. Reinstall Python 2.7.5, making sure it is the 32 bit version (x86)
  3. Reinstall my IDE "PyScripter", making sure it is the 32 bit version (x86)

Altri suggerimenti

To reiterate what Leandro has said, you do not need to easy_install cx_Oracle if you have already ran the .msi installer and you need to install the oracle instantclient.

As you have already found out, installing the oracle instantclient means that you simply need to unzip it into a folder in your system (e.g.: C:\oraclient).

Some things to keep in mind:

Make sure you are using the same version (or compatible versions) of cx_Oracle, instantclient, and the database server itself. For instance the instantclient v12 does not support database servers below version 10). Also, make sure you are using all 32 bit or all 64 bit versions (including cx_Oracle, the instantclient, and python itself).

Also, you will need to set the environment variables ORACLE_HOME and PATH to the directory where you unzipped the oracle instantclient (e.g.: C:\oraclient) in order to avoid the ImportError you mentioned (DLL load failed: %1 is not a valid Win32 application). The ImportError simply means that it could not find the needed libraries.

The easy_install step is trying to compile cx_Oracle sources on your machine, but that is not necessary as you have already installed the MSI, which is a pre-compiled, binary version.

The MSI you installed should be enough to use cx_Oracle, provided you have the binary Oracle client installed as well (for example, the instantclient).

Since cx_Oracle only connects using the Oracle TNS Names facility, you may also need to set the TNS_ADMIN environment variable to indicate where there TNS Names file to be used is located. That issue bit me as well.

For Windows 7 64 bit you need "Windows amd64 Installer (Oracle 11g, Python 3.3)". It works on Intel as well.

I have no InstantClient but use SQL*Plus from Oracle 11.2 installation (64 bit).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top