zoukankan      html  css  js  c++  java
  • 报错:SyntaxError: Non-ASCII character 'xe4' in file

    SyntaxError: Non-ASCII character 'xe1' in file recommendation.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    原因:注释里面出现了中文,而 Python 支持的 ASCII 码无中文。

    在ython官网得到如下帮助信息:

    Python will default to ASCII as standard encoding if no other encoding hints are given.

    翻译:如果没有其他编码提示,Python将默认为ASCII作为标准编码。

    To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file

    翻译:要定义源代码编码,必须在源文件中第一行或第二行放置一个魔术注释。

    解决办法:

    在头文件中添加如下代码:

    # -*- coding: utf-8 -*-
    
  • 相关阅读:
    二分查找
    基本功能
    pandas的数据结构
    部署metrics-server遇到的坑
    Promethus安装指南
    Spark学习笔记
    Hadoop学习笔记
    大数据处理框架
    大数据Hadoop生态圈:Pig和Hive
    Hadoop HA 机制学习
  • 原文地址:https://www.cnblogs.com/zzdbullet/p/10163429.html
Copyright © 2011-2022 走看看