APT之Unable to get the locale encoding

永久地址:APT之Unable to get the locale encoding(保存网址不迷路 🙃)

 

问题描述

在执行apt-get install -y pypy-setuptools命令时,产生如下错误:

The following additional packages will be installed:
  pypy-pkg-resources
Suggested packages:
  python-setuptools-doc
The following NEW packages will be installed:
  pypy-pkg-resources pypy-setuptools
0 upgraded, 2 newly installed, 0 to remove and 1411 not upgraded.
Need to get 461 kB of archives.
After this operation, 1,903 kB of additional disk space will be used.
Get:1 http://mirrors.ustc.edu.cn/kali kali-rolling/main amd64 pypy-pkg-resources all 41.1.0-1 [154 kB]
Get:2 http://mirrors.ustc.edu.cn/kali kali-rolling/main amd64 pypy-setuptools all 41.1.0-1 [307 kB]
Fetched 461 kB in 8s (56.5 kB/s)
Fatal Python error: initfsencoding: Unable to get the locale encoding
  File "/usr/lib/python2.7/encodings/__init__.py", line 123
    raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax

Current thread 0x00007f5bf683b740 (most recent call first):
/bin/sh: line 1: 19958 Aborted                 /usr/bin/apt-listchanges --apt
E: Sub-process /usr/bin/apt-listchanges --apt || test $? -lt 10 returned an error code (1)
E: Failure running script /usr/bin/apt-listchanges --apt || test $? -lt 10

操作系统:Kali GNU/Linux Rolling

问题原因

这是我们自己的问题。在执行pypy命令时,出现No module named错误,由于不知道如何使用pypy命令,盲目设置PYTHONPATH环境变量。

实际上pypy有自己的site-packages路径,所以要单独安装pip命令,而不是修改PYTHONPATH环境变量。

解决办法

取消环境变量PYTHONPATH的设置:

unset PYTHONPATH

相关文章

「APT」- The following signatures were invalid
「APT」- E: Sub-process /usr/bin/dpkg returned an error code (1)

参考文献

Fatal Python error: Py_Initialize: Unable to get the locale encoding … SyntaxError: invalid syntax Aborted (core dumped)
All Debian package managers broken due to Python bug

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值