V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
littlepython
V2EX  ›  Linux

centos6.8 设置系统编码问题

  •  1
     
  •   littlepython · 2019-08-24 15:24:26 +08:00 · 3118 次点击
    这是一个创建于 1699 天前的主题,其中的信息可能已经有所发展或是发生改变。
    每次登录显示这种问题
    -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 条回复    2019-08-25 11:14:02 +08:00
    iUnix
        1
    iUnix  
       2019-08-25 11:14:02 +08:00 via Android
    登录提示的问题跟你 python 的问题无关。
    1,安装相应 locale 或者将 locale 设置为你系统现有的
    2,应该某个地方如~/.profile 运行了 ulimit,而你这个用户没权限

    python 设置用 utf8 试试。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5353 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 08:58 · PVG 16:58 · LAX 01:58 · JFK 04:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.