UnicodeDecodeError:'ascii'编解码器无法解码位置*的字节0x *:序数不在范围内(128)


23

我试图输入以下命令

add-apt-repository ppa:ondrej/php5
You are about to add the following PPA to your system:
 This branch follows latest PHP packages as maintained by me & rest of the Debian pkg-php team.

You can get more information about the packages at https://sury.org

If you need to stay with PHP 5.4 you can use the oldstable PHP repository:

    ppa:ondrej/php5-oldstable
...
gpg: keyring `/tmp/tmpy7ajyf/secring.gpg' created
gpg: keyring `/tmp/tmpy7ajyf/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpy7ajyf/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ond\xc5\x99ej Surý" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.3/threading.py", line 639, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 141, in run
    self.add_ppa_signing_key(self.ppa_path)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 238, in add_ppa_signing_key
    tmp_export_keyring, signing_key_fingerprint, tmp_keyring_dir):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 190, in _verify_fingerprint
    got_fingerprints = self._get_fingerprints(keyring, keyring_dir)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 182, in _get_fingerprints
    output = subprocess.check_output(cmd, universal_newlines=True)
  File "/usr/lib/python3.3/subprocess.py", line 575, in check_output
    output, unused_err = process.communicate(timeout=timeout)
  File "/usr/lib/python3.3/subprocess.py", line 909, in communicate
    stdout = _eintr_retry_call(self.stdout.read)
  File "/usr/lib/python3.3/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
  File "/usr/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 92: ordinal not in range(128)

我正在尝试安装php5.5。

有没有解决此错误的方法?

或如何解决?

语言环境广告内容-a的内容

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en.UTF-8
LANGUAGE=
LC_CTYPE="en.UTF-8"
LC_NUMERIC="en.UTF-8"
LC_TIME="en.UTF-8"
LC_COLLATE="en.UTF-8"
LC_MONETARY="en.UTF-8"
LC_MESSAGES="en.UTF-8"
LC_PAPER="en.UTF-8"
LC_NAME="en.UTF-8"
LC_ADDRESS="en.UTF-8"
LC_TELEPHONE="en.UTF-8"
LC_MEASUREMENT="en.UTF-8"
LC_IDENTIFICATION="en.UTF-8"
LC_ALL=
locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX

 locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX

你不能从这里安装吗?
Wilf

这是一台服务器,我所拥有的只是命令行
SamFisher83

您是否尝试过建议并使用它ppa:ondrej/php5-oldstable?也尝试更新python-software-properties
Wilf

oldstable做同样的事情
SamFisher83

Answers:


39

locale -a输出表明您已经没有启用的UTF-8语言环境。尝试运行:

sudo locale-gen en_US.UTF-8
export LANG=en_US.UTF-8

仔细观察一下C.UTF-8,您可以尝试仅切换到该位置:

export LANG=C.UTF-8

我试图进行设置,但这没有用。感谢您的建议
SamFisher83

@ SamFisher83的输出是locale什么?的输出是locale -a什么?
falconer

我编辑我的主帖
SamFisher83

@ SamFisher83我更新了答案。
falconer

1
它对我有帮助,谢谢!在我的无所事事的shell脚本的开头,我添加了“ locale -a”显示的所有行的“ export” :-)
starikovs 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.