Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
littlepython
V2EX  ›  Linux

centos6.8 设置系统编码问题

  •  1
     
  •   littlepython · Aug 24, 2019 · 4047 views
    This topic created in 2476 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 这种
    1 replies    2019-08-25 11:14:02 +08:00
    iUnix
        1
    iUnix  
       Aug 25, 2019 via Android
    登录提示的问题跟你 python 的问题无关。
    1,安装相应 locale 或者将 locale 设置为你系统现有的
    2,应该某个地方如~/.profile 运行了 ulimit,而你这个用户没权限

    python 设置用 utf8 试试。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5538 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 06:39 · PVG 14:39 · LAX 23:39 · JFK 02:39
    ♥ Do have faith in what you're doing.