安装python解释器
安装PyDev:
首先需要去Eclipse官网下载:http://www.eclipse.org/,Eclipse需要JDK支持,如果Eclipse无法正常运行,请到Java官网下载JDK安装:http://www.oracle.com/technetwork/java/javase/downloads。
打开Eclipse,找到Help菜单栏,进入Install New Software…选项。
id="iframe_0.6955964027438313" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/0.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6955964027438313',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 705px; height: 44px;">
点击work with:输入框的旁边点击Add…,Name可以随便是什么,我输入的是PyDev,Location是http://pydev.org/updates。点击OK。
id="iframe_0.6775817018933594" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/11.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6775817018933594',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 485px; height: 198px;">
等待一下,便可以在选择栏里看到各个选项。
id="iframe_0.7158795220311731" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/2-300x135.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7158795220311731',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 300px; height: 134px;">
选择PyDev,然后一路Next,进入安装路径选择界面,使用默认设置,然后 Finish。Eclipse将下载 PyDev,可以从 Eclipse任务栏中看到下载的进度。PyDev安装好后,需要重启Eclipse。
配置PyDev:
PyDev安装好之后,需要配置解释器。在 Eclipse 菜单栏中,选择Window > Preferences > Pydev > Interpreter – Python,在此配置 Python。首先需要添加已安装的解释器。如果没有下载安装Python,请到官网下载2.x或者3.x版本:http://www.python.org/。
id="iframe_0.2519902924541384" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/4.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.2519902924541384',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 792px; height: 650px;">
我使用的是Python3.x版本,Python安装在D:\Python32 路径下。单击 New,进入对话框。Interpreter Name可以随便命名,Interpreter Executable选择Python解释器python.exe。
id="iframe_0.4620333674829453" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/5.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.4620333674829453',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 562px; height: 250px;">
点击OK后跳出一个有很多复选框的窗口,选择需要加入SYSTEM pythonpath的选项,点击Ok。
id="iframe_0.30568549083545804" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/6.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.30568549083545804',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 662px; height: 536px;">
然后在Python Interpreters的窗口,再次点击OK,即完成了Python解释器的配置。
到此PyDev就已经完成了配置,可以使用Eclipse开始编写Python。
Hola World:
在 Eclipse 菜单栏中,选择File > New > Pydev > Project…,在窗口中选择PyDev Project,有三种项目可以创建,选择PyDev Project。
id="iframe_0.5252691840287298" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/7.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5252691840287298',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 270px; height: 88px;">
点击Next,输入项目名,选择相应的项目类型,以及所使用的Python语法版本和Python解释器。
id="iframe_0.6761474038939923" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/8.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6761474038939923',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 525px; height: 634px;">
创建成功后,进入透视图,右击src图标,选择New->Pydev Package,创建一个新的包。系统将自动生成__init__.py 文件,该文件不包含任何内容。再右键单击创建的包,选择 New->Pydev Module,创建你一个新的Python模块,单击Finish。
这样我们就可以开始创建第一个.py文件了。
id="iframe_0.8081179538276047" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.qrong.com/wp-content/uploads/2011/08/9.jpg?_=2603848%22%20style=%22border:none;max-width:1079px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.8081179538276047',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="border-style: none; border-width: initial; width: 314px; height: 317px;">
source:http://blog.csdn.net/sunshine3257/article/details/7408102