文件中非ASCII字符'\xe2',但未声明编码 [英] Non-ASCII character '\xe2' in file but no encoding declared

查看:311
本文介绍了文件中非ASCII字符'\xe2',但未声明编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个脚本,使用 wfdb python库。当我在 windows 上运行脚本时,该脚本运行良好,但最近我改用了 Mac 。安装所有依赖项后,尝试从 wfdb 库导入 处理 时出现错误。这是我得到的错误:

I wrote a script to extract signals from the MIT-BIH dataset using the wfdb python library. The script was working fine when I was running it on windows but I recently shifted to Mac. After installing all the dependencies I got an error when I tried to import processing from the wfdb library. This is the error I get:


语法错误:文件/ usr / local / lib / python2中的非ASCII字符'\xe2' .7 / site-packages / scipy / stats / _continuous_distns.py,第3346行,但未声明编码;参见> http://python.org/dev/peps/pep-0263/ 详细信息

导入wfdb可以正常工作,但是当我从wfdb导入处理中执行时似乎出现了问题。有什么办法解决这个问题?

import wfdb works fine but there seems to be a problem when I do from wfdb import processing. Is there any way to solve this issue?

推荐答案

请在代码顶部添加以下行。

Please add following line at the top of the code.

# -*- coding: utf-8 -*-

此外,请避免使用非ascii引号。

Also, avoid using non-ascii quotations.

这篇关于文件中非ASCII字符'\xe2',但未声明编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆