推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
littlepython
V2EX  ›  Python

centos6.8 系统编码和 Python 文件的编码问题

  •  
  •   littlepython · Aug 24, 2019 · 2504 views
    This topic created in 2472 days ago, the information mentioned may be changed or developed.
    每次登录显示这种问题
    -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
    -bash: ulimit: open files: cannot modify limit: Operation not permitted

    然后运行 python 文件 打印中文日志就会出现
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)

    这种该怎么设置正常呀 用 python 打印出来的系统编码是 ANSI 这种
    3 replies    2019-08-25 13:46:38 +08:00
    hangvane
        1
    hangvane  
       Aug 24, 2019   ❤️ 1
    试试这条?我用来解决 docker 容器中无法正常显示中文的问题
    echo "export LANG=C.UTF-8" >>/etc/profile
    littlepython
        2
    littlepython  
    OP
       Aug 24, 2019
    @hangvane 好像不行
    tempdban
        3
    tempdban  
       Aug 25, 2019 via Android
    你是不是自己换过 libc
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2659 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 11:42 · PVG 19:42 · LAX 04:42 · JFK 07:42
    ♥ Do have faith in what you're doing.