夜猫的个人小站

       继续码起来

关于作者

微博北极熊硬糖
北京海淀区
python3在linux运行输出中文出错

py文件是#encoding=utf-8编码 然后执行时输出错误 print('\u2312') 这是默认输出编码为ascii。 可进入python执行环境下查看 ``` import sys sys.stdout ``` ### 解决办法1: If you get this error when you try to pipe/redirect output of your script UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128) Just export PYTHONIOENCODING in console and then run your code. 修改.profile 添加一行: PYTHONIOENCODING=utf-8 后执行source .profile ###解决办法2: 在py文件开头加入: ``` import sys import

阅读全文 浏览数
网站建设14:pip install 总是Read Timeout Error

建个文件 ~/.pip/pip.conf, 内容如下 ``` [global] timeout = 6000 index-url = http://pypi.douban.com/simple/ [install] use-mirrors = true mirrors = http://pypi.douban.com/simple/ trusted-host = pypi.douban.com ```

阅读全文 浏览数
回到顶部