1. 官网下载xlwt包
https://pypi.python.org/pypi/xlwt#downloads
2. 解压之后打开cmd命令行进入对应目录下执行setup命令
D:\Chrome下载\xlwt-1.1.2\xlwt-1.1.2>python setup.py install
3. 如果是python3.6的版本会报如下错误
File "C:\Users\10955837\AppData\Local\Programs\Python\Python36-32\lib\sre_parse.py", line 833, in fix_flags
raise ValueError("cannot use LOCALE flag with a str pattern")
ValueError: cannot use LOCALE flag with a str pattern
解决办法:
修改sre_parse.py的833行
原语句:
if flags & SRE_FLAG_LOCALE:
raise ValueError("cannot use LOCALE flag with a str pattern")
修改后:
if flags & SRE_FLAG_LOCALE:
pass #stone20161228 raise ValueError("cannot use LOCALE flag with a str pattern")
4. 再次执行setup命令,安装成功