具体错误如下
File "D:/Ng-DL-HW/course2/week1/initialization/zero_init.py", line 96
SyntaxError: Non-ASCII character '\xe2' in file D:/Ng-DL-HW/course2/week1/initialization/zero_init.py on line 96, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
报错原因
1.SyntaxError: Non-ASCII character '\xe2' in file意思是说,在文件中存在非ASCII字符;
2.ASCII是8位即一个字符,一共256个字符,随着计算机的发展,现在已经用到2个或者4个字符;
3.最重要的原因就是文件中有中文
解决
建议在文件头追加:
# -*- coding: cp936 -*-
或者
# -*- coding: utf-8 -*