资源描述:
《解决eclipse + pydev 编译过程中有中文的问题》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、最近在学习python编程,开发环境设置好了,是用eclipse+pydev来做开发的环境,配置好了之后,需要解决的一个关键问题就是老问题了:如何解决代码中的中文问题。。。 其实但我们在配置编程环境的时候,就需要设置2个地方。 首先打开eclipse,点击菜单 window---Preferences--General--Editors--TextEditor--Spelling---Encoding,选择other:选择"UTF-8"即可。如图: 接下来还有一个地方window---Preferences--General--Work
2、space,在Textfileencoding那里选择other,然后选择“UTF-8”,如图即可。20currencydeposit,weprescribeapassonaregularbasis,qilucardaccountonaregularbasis),certificatebondsandsavingsbonds(electronic);3.notdrawnonabanksavingscertificate,certificatebondsapplyformortgageloans,acceptingonlythelender ,网上很
3、多资料都是到这里就为止了,我也当时以为这样就可以解决代码中有中文的问题了,于是就开始写代码了,但是老是报错,在中间用debug模式下看到是一个python源代码的文件报错,试着修改过那个文件,但是网上找的版本都是1.3的,我现在用的pydev的版本是1.6的,所有还是没有解决,那个郁闷啊。。。 代码中不能有中文,实在很讨厌,我是新手,不能用中文做注释,那个痛苦啊。。。后来才知道,其实只要在每个模块的第一行添加编码规则就可以解决中文问题了,就是添加一句:#-*-encoding:utf-8-*-20currencydeposit,weprescri
4、beapassonaregularbasis,qilucardaccountonaregularbasis),certificatebondsandsavingsbonds(electronic);3.notdrawnonabanksavingscertificate,certificatebondsapplyformortgageloans,acceptingonlythelender有了这句编码规则的语句,代码中有中文,照样可以运行程序。。。 过了不久,我又感觉有点不爽了,每次我新建一个模块的时候,eclipse每次都会帮我自动生成一些比如:'
5、''Createdon2010-12-28@author:501914252'''这些作者的信息,偏偏我每次都要在每个模块添加的那句编码规则的语句没有,很是生气啊,觉得应该在eclipse里面有设置的地方,嘿嘿,经过一番折腾和网友的帮助,终于解决了这个问题,解决如下:window--Preferences--Pydev--Editor--Template--Empty,然后点击“Edit”按钮,把我们要添加的语句加进去就可以了,如图:20currencydeposit,weprescribeapassonaregularbasis,qilucarda
6、ccountonaregularbasis),certificatebondsandsavingsbonds(electronic);3.notdrawnonabanksavingscertificate,certificatebondsapplyformortgageloans,acceptingonlythelender后你在新建一个模块试试,哈哈。。。再也不需要每次都要复制那个编码语句了。。。 如果你还没有解决这个问题,还不快去试试,希望可以帮助您解决问题。。。注意:是在开头第一行加#-*-encoding:utf-8-*-不是在…后20cu
7、rrencydeposit,weprescribeapassonaregularbasis,qilucardaccountonaregularbasis),certificatebondsandsavingsbonds(electronic);3.notdrawnonabanksavingscertificate,certificatebondsapplyformortgageloans,acceptingonlythelender