Skip to content

Instantly share code, notes, and snippets.

@comwrg
Created November 22, 2017 08:21
Show Gist options
  • Save comwrg/8277bfa991d5e1cf20e714cb0b5086e8 to your computer and use it in GitHub Desktop.
Save comwrg/8277bfa991d5e1cf20e714cb0b5086e8 to your computer and use it in GitHub Desktop.
python2.x, 关于windows目录下带中文报ASCII错误解决办法

error

UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-5: ordinal not in range(128)

solution

reference: https://www.v2ex.com/t/90659 python目录 Python27\Lib\site-packages 建一个文件sitecustomize.py 内容写: import sys sys.setdefaultencoding('gb2312') python会自动运行这个文件。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment