Oracle install within PyDev
I am on Windows 10 Pro 64-bit Anniversary Edition using Python 3.5.2 (Anaconda 4.1.1). I download the latest Oracle 12c Instant Client instantclient-basic-windows.x64-12.1.0.2.0.zip and instantclient-sdk-windows.x64-12.1.0.2.0.zip into C:instantclient and put C:instantclient on my PATH . Then I download the installer cx_Oracle-5.2.1-12c.win-amd64-py3.5.exe directly from PyPI .
Now I can start an Anaconda python prompt and type import cx_Oracle and it is successful.
>>> import cx_Oracle
>>>
By when I go into my PyDev installation on Eclipse Neon (4.6), the import cx_Oracle line in my source file still shows an error as an unresolved import.
C:binanaconda3python.exe ) and added it back. I restarted Eclipse, but no luck. import cx_Oracle as an unresolved import. How can I get PyDev to see my cx_Oracle package installation?
Note that there are a lot of supposed answers that do not work for me; I've tried all the suggestions, as indicated above.
You can try this (after the steps that you already report in your question)
Check if the installation in PyDev is ok (besides showing an error marker for import cx_Oracle )
import cx_Oracle
conn = cx_Oracle.connect('hr/hr@pdborcl')
cur = conn.cursor()
cur.execute('select 13 from dual')
for r in cur.fetchall():
print(r)
If this works, and prints (13,) the installation is correct. Likely some part of completion could work as well. In addition, Shift+Click on cx_Oracle should report The definition of ... was found at ... .
Go to Windows > Preferences > PyDev > Interpreters > Python Interpreter and on the tab Forced builtins add cx_Oracle
After rebuilding the project, the error markers on the import should go away. (In the little test program I just did a trivial edit and saved.)
For the record:
Eclipse Version: 4.6.0 (Neon)
PyDev Version: 5.2.0
Python: 3.5.2 (from a virtualenv)
链接地址: http://www.djcxy.com/p/67896.html
上一篇: 将LinkedList放入Intent extra时,会在下次活动中检索时重新映射到ArrayList
下一篇: Oracle在PyDev中安装
