ImportError: No module named 'cx_Oracle'问题处理
发布时间:2020-12-12 12:49:21 所属栏目:百科 来源:网络整理
导读:错误如下: E:pargram pythonPython 3.5.2 |Anaconda 4.2.0 (64-bit)| (default,Jul 5 2016,11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 Type " help " , " copyright " , " credits " or " license " for more information. import cx_OracleTracebac
错误如下: E:pargram>python Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default,Jul 5 2016,11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 执行过 pip install cx_Oracle
E:pargram>pip install cx_Oracle-7.1.3-cp35-cp35m-win_amd64.whl Processing e:pargramcx_oracle-7.1.3-cp35-cp35m-win_amd64.whl Installing collected packages: cx-Oracle Successfully installed cx-Oracle-7.1.3 还是报错。 最后只能选择 cxoModule.obj : warning LNK4197: export ‘PyInit_cx_Oracle‘ specified multiple times; using first specification Creating library buildtemp.win-amd64-3.5Releasesrccx_Oracle.cp35-win_amd64.lib and object buildtemp.win-amd64-3.5 Releasesrccx_Oracle.cp35-win_amd64.expGenerating codeFinished generating code LINK : fatal error LNK1158: cannot run ‘rc.exe‘ error: command ‘C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64 link.exe‘ failed with exit status 1158 解决办法:
D:&;pythonPython 3.5.2 |Anaconda 4.2.0 (64-bit)| (default,11:41:13) [MSC v.1900 64 bit (AMD64)] on win32Type "help","credits" or "license" for more information. >>> import cx_Oracle 但是 >>> conn=cx_Oracle.connect(‘scott/[email?protected]:1521/orcl‘) Traceback (most recent call last): File "<stdin>",in <module>cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804 发现应该是Oracle client问题。 安装了oracle11g client终于成功了 简单验证: E:&;python Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default,11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 Type "help","credits" or "license" for more information. >>> import cx_Oracle >>> conn=cx_Oracle.connect(‘scott/[email?protected]:1521/orcl‘) >>> curs=conn.cursor() >>> sql=‘select * from dept‘ >>> curs.execute (sql) >>> row=curs.fetchone() >>> print(row[0]) 10 >>> print(row[1]) ACCOUNTING >>> curs.close() >>> conn.close() ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |