Installing Python 3 and Eclipse for
Windows
Note: Keep in
mind that PyDev 5.x requires Eclipse 4.6 onwards (for Eclipse 3.8 use PyDev
4.x).
The
highest version of 4.x listed is 4.5.5; we can copy the link http://www.pydev.org/update_sites/4.5.5 and paste
into eclipse's Install New Software
Steps to configure Python with
Eclipse:
Step
1: Install java
Step
2: Install Python 3
Step
3: Install or Extract eclipse
Ø
Open Eclipse -> Help -> Install New
Software... -> Add
·
Name: PyDev
Ø
Click OK
Ø
Select "PyDev for Eclipse" and remain all default
Ø
Click Next
-> review the items to be installed -> Next
Ø
Check "I accept the terms of the license
agreement -> Finish
Ø
Accept the certificates -> Click OK
Ø
Restart Eclipse
Ø
Open Eclipse -> Windows -> Preferences ->
expand "PyDev" -> Interpreter - Python --> click on New and select the python executable (python.exe) from the python installed
location -> Click OK -> Click OK
Ø
General -> Editors -> Text Editors -> check Show
Line Numbers -> OK (and it's
going to go in and configure Python.)
Ø
Under Perspectives
-> Other -> select the "PyDev" perspective, because that's
what we're going to be using.
Ø
Right click on Java -> close, if
java development is not required.
Now
we're ready to create and configure our new python project with eclipse.
Python Interpreter Configuration
Ø
Select Window -> Preferences -> PyDev
-> Interpreters -> Python Interpreter -> New (or Auto-Config).
Ø
Select location of python.exe for which cx_Oracle
has been configured (32 Bit or 64 Bit), check oracle database server or client
version using
Ø
Run-> cmd -> tnsping
Ø
Apply - > OK
Python cx_Oracle Configuration
Ø
Select Window -> Preferences -> PyDev
-> Interpreters -> Python Interpreter -> Forced Builtins
Ø
New -> cx_Oracle -> OK
Python Oracle Project
Ø
Select File -> New-> PyDev Project
Ø
Project Name -> MyDemo
Ø
Project Type -> Python
Ø
Grammar Version -> 3-3.5
Ø
Interpreter -> Python
Ø
Finish
Ø
Right Click on Project Name (MyDemo)
Ø
New-> PyDev Module
Ø
Name -> DBTest
Paste
below code in DBTest.py file
#
Code start
import
cx_Oracle
class
MyClass(object):
'''
classdocs
'''
def
__init__(self):
con = cx_Oracle.connect('hr/hr@orcl')
# do some stuff here
#ver =
con.version.split(".")
#print(ver)
#print(con.version)
cur = con.cursor()
cur.execute('select
e.employee_id,e.first_name,e.last_name from EMPLOYEES e where rownum<2 order
by 2')
for
result in cur:
#print(result)
print(result[0],",",result[1],"
",result[2])
cur.close()
con.close()
'''
Constructor
'''
MyClass()
#
Code end
Execute Python Module
Run
-> Run As -> 1 Python Run
Output
Console
100 , First_Name Last_Name
I
hope you all have enjoyed reading this article. Comments are welcome....
Related Posts:
- Connect Python 3.6 with Oracle 12c on Windows 7 x64
- Oracle subprograms and Python Programming
Related Posts:
- Connect Python 3.6 with Oracle 12c on Windows 7 x64
- Oracle subprograms and Python Programming
Casinos Near Me | Jtm Hub
ReplyDeleteA map showing casinos and other gambling 하남 출장마사지 facilities located near Casinos Near Me, The Casino of San Diego, California, CA. Map How far 원주 출장안마 is Casinos 제주도 출장샵 Near 경상남도 출장마사지 Me?Is it 여수 출장안마 safe to play at Casinos Near Me?