Truth be told, I have never used eclipse for python. but it would be great to integrate all popular programming languages into one IDE.
Installation
Pydev is a plugin that enables users to use Eclipse for Python and Jython development. It distributed under the EPL license.
Before getting started, please make sure you have following software installed in your system:
- Eclipse
- Python Interpreter: Generally, python is a build-in software for Linux.
- Start your eclipse
- Click "Help" -> "Software Updates"
- In "Available Software" section, press "Add Site" button
- add the url "http://pydev.sourceforge.net/updates/" and click "OK"
- Check and install the Pydev
After the installation, you probably need to given a path of python interpreter in eclipse's "Preference".
- in eclipse, click "Window" -> "Preference"
- expend the "Pydev", click "Interpreter - Python"
- in "Python interpreter" section, click "New" button
- setup a location of the python interpreter.

Create a python project
- in eclipse, click "File" -> "New" -> "Other"
- expand the "Pydev", click "Pydev Project"
- given a project name and click "Finish"

- in eclipse's Package Explorer, click your python project's "src"
- click "File" -> "New" -> "Other"
- expand the "Pydev", click "Pydev Module"
- click "Next" to continue
- given a module name and leave the template <Empty>
- click "Finish"


Below is a very trivial example to output an inverse triangular shape.
# An ugly recursive method
def star(start, end ,step, pat, pre):
if(start < end): star(start + step, end, step, pat, pre + pat)
print pre.center(end * len(pat))
height = int(raw_input("Please enter a height:"))
star(1, height, 1, "* ", "* ")
Compile and Run
Just press the "Run As" and choose the "Python Run", you will see a BEAUTIFUL pattern.
* * * * *
* * * *
* * *
* *
*
(Your output might different with mine. If you are really confused about it. You must be a ...... idiot!)
Conclusion
For the newer, Pydev could be your first choice for python programming.
0 意見:
Post a Comment