---
title: "SyntaxError: Non-ASCII character '\\xe5' in file"
author: "berdy"
date: "2013-07-06T09:50:53Z"
tags: []
categories: ["编程语言"]
slug: "syntaxerror-non-ascii-character-xe5-in-file"
draft: false
lastmod: "2013-07-06T09:51:13Z"
id: 1900362
url: "https://berdy.iteye.com/blog/1900362"
---

eclipse中安装好pydev，最近安装的时候总是提示不成功。
提示错误连接超时 Read time out。后来爬出去后再安装，ok了
配置好pydev后，新建一个module，print 'hello world',
结果却提示SyntaxError: Non-ASCII character '\xe5' in file
查看了错误信息中的链接，发现原来python解释器在读取到文件中有
非ASCII字符时，需要源文件中有coding hint。
解决办法就是要在 python源文件的第一或第二行给出coding hint。添加

# coding=utf-8

具体的格式必须匹配这个表达式 "coding\s*(+)"