Posts Tagged ‘develop’

eclipse for python 中文配置

星期三, 08月 1st, 2007

经过长期的查询和各项性能的分析,决定使用eclipse来进行python的学习,由于linux下,调试比较麻烦(字符看着还是不爽)首次试验发现eclipse下可以支持中文字符,不错,komodo就烂多了,之后试验了下

c=哈哈
print c
print

居然报错,SyntaxError: Non-ASCII character ‘\xd6′ in file F:\python\src\frist.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

但是在idle中没有问题,可以输出。

经过google大师的指引,找到一片文章,说要在文件头加入# -*- coding: gb18030 -*-

才能支持中文。试验了下真的成功了。

eclipse for python

星期三, 08月 1st, 2007

今天发现eclipse做len()测量长度的时候发现总是多算一位:

1
2
3
4
5
6
while True:
s = str(raw_input('Enter something : '))
if s == 'quit':
break
print 'Length of the string is', len(s)
print 'Done'

结果:

1
2
3
Enter something : quit
Length of the string is 5
Enter something :

真是好郁闷!但是在idle中就没有问题,可见是eclipse的问题。一下午没有解决,最后换了komodo3.5就没问题了。希望知道为什么的朋友给流个言!~谢谢

如何在eclipse上开发python

星期二, 07月 31st, 2007

首先,从 Eclipse Web 站点根据您的平台下载 Eclipse,按照下面的安装指南安装 Eclipse: 可以查询google,找到汉化,本人英文不好。

Eclipse 的更新机制使 PyDev 插件的安装更加容易。从 Eclipse 中选择 帮助(Help) > 软件更新(Software Updates) > 查找并安装(Update Manager),启动 搜索要安装的新功能部件。新建远程站点,Eclipse 的 PyDev 更新站点 URL 为http://pydev.sf.net/updates/。选中对话框中新建的站点点完成。

展开PyDev > Other,选择其中显示的 PyDev 特性(我选的1.10,因为我的eclipse是3.1)。然后选择 “Install Now”安装该特性。Eclipse 将下载 PyDev 插件,并将其安装到 Eclipse 中。之后在窗口->首选项-> pydev->interpreter python,点右边新建,找到你的python安装目录,选择python的启动文件,点应用,之后你就可以用eclipse来开发python!