原因是pip安装python包会加载我的用户目录,我的用户目录恰好是中文的,ascii不能编码。解决办法是: python目录 Python27\Lib\site-packages 建一个文件sitecustomize.py 内容写: import sys sys.setdefaultencoding('gb2312') python会自动运行这个文件。
快来加入群【python爬虫交流群】(群号570070796),发现精彩内容。