我安装了Python 2.7.7 :: Anaconda 2.0.1(64位)。目前我正在尝试运行命令" import cx_Oracle"。我运行了easy_install,它成功地将cx_Oracle蛋添加到" site_packages"文件夹anaconda目录获取消息"已安装c:\ fast \ anaconda \ 2.0.1 \ lib \ site-packages \ cx_oracle-5.1.3-py2.7-win-amd64"。' 现在每当我尝试命令" import cx_Oracle"在python终端中我收到错误" ImportError:DLL加载失败:%1不是有效的Win32应用程序"。我尝试安装特定的32位版本的cx_Oracle,但它仍然产生相同的输出"安装c:\ fast \ anaconda \ 2.0.1 \ lib \ site-packages \ cx_oracle-5.1.3-py2.7 -WIN-AMD64&#34 ;. 有没有人成功解决这个问题?
答案 0 :(得分:3)
您可以安装cx_Oracle
Python包as follows:
conda install -c https://conda.anaconda.org/anaconda cx_oracle
除此之外,它还将负责安装合适的Oracle客户端:
C:\Anaconda>conda install -c https://conda.anaconda.org/anaconda cx_oracle
Fetching package metadata: ......
Solving package specifications: .
Package plan for installation in environment C:\Anaconda:
The following packages will be downloaded:
package | build
---------------------------|-----------------
oracle-instantclient-11.2.0.4.0| 0 50.9 MB
cx_oracle-5.1.2 | py27_0 55 KB
pyyaml-3.11 | py27_2 167 KB
requests-2.8.0 | py27_0 598 KB
setuptools-18.3.2 | py27_0 647 KB
conda-3.18.1 | py27_0 215 KB
------------------------------------------------------------
Total: 52.5 MB
The following NEW packages will be INSTALLED:
cx_oracle: 5.1.2-py27_0
oracle-instantclient: 11.2.0.4.0-0
The following packages will be UPDATED:
conda: 3.16.0-py27_0 --> 3.18.1-py27_0
pyyaml: 3.11-py27_1 --> 3.11-py27_2
requests: 2.7.0-py27_0 --> 2.8.0-py27_0
setuptools: 18.1-py27_0 --> 18.3.2-py27_0
Proceed ([y]/n)? y
Fetching packages ...
oracle-instant 100% |###############################| Time: 0:00:04 11.48 MB/s
cx_oracle-5.1. 100% |###############################| Time: 0:00:00 1.77 MB/s
pyyaml-3.11-py 100% |###############################| Time: 0:00:00 2.14 MB/s
requests-2.8.0 100% |###############################| Time: 0:00:00 3.82 MB/s
setuptools-18. 100% |###############################| Time: 0:00:00 4.25 MB/s
conda-3.18.1-p 100% |###############################| Time: 0:00:00 1.11 MB/s
Extracting packages ...
[ COMPLETE ]|##################################################| 100%
Unlinking packages ...
[ COMPLETE ]|##################################################| 100%
Linking packages ...
[ COMPLETE ]|##################################################| 100%
答案 1 :(得分:1)
我安装了32位版本的oracle客户端。一旦我安装了64位版本,它就可以正常工作。
答案 2 :(得分:0)
Oracle客户端和Python平台必须相同(64或32位)
使用以下方式确定您当前的平台:
import platform
platform.architecture()
如果这对写作没有帮助,则默认安装版本5.3会出现问题。您可以尝试安装版本6.0b2
python -m pip install cx_Oracle --pre
当Anaconda失败时。你可以试试pip。