1.执行脚本报错:
Non-ASCII character '\xe8' in file xxx.py on line 8, but no encoding declared
File "xxx.py", line 8 SyntaxError: Non-ASCII character '\xe8' in file xxx.py on line 8, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
原因是缺少编码类型声明:no encoding declared
段首添加一行声明即可:
#encoding:utf-8
2.执行脚本报错:
ImportError: No module named 'requests'
缺少requests模块,执行pip install requests
如果缺少pip命令,先安装pip
执行yum -y install python-pip
如果很慢就换个源
pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple/
网友评论