几天前,我尝试在 Debian 系统上安装 git。安装中止,从那时起,每次我尝试通过 apt 安装/删除某些内容时,都会收到语言环境错误 -.-
apt-get remove git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
git
0 upgraded, 0 newly installed, 1 to remove and 75 not upgraded.
18 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = "de_DE",
LANG = "de_DE@euro"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Kann LC_ALL nicht auf die Standard-Lokale einstellen: Datei oder Verzeichnis nicht gefunden
dpkg: error processing git (--remove):
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
Errors were encountered while processing:
git
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试重新配置语言环境,但出现相同的错误...我该如何修复?
问候语
答案1
区域设置警告与 git 问题无关。按照说明,您需要尝试apt-get install --reinstall git
或aptitude reinstall git
,然后再次尝试将其删除。如果您在 /var/cache/apt/archives 中有 git 包,您也可以尝试使用类似的东西重新安装dpkg -i /var/cache/apt/archives/git_....deb
(确切的文件名会根据 git 的 arch 和版本而有所不同)
答案2
18 not fully installed or removed.
您有 18 个软件包处于中间状态,您应该先解决该问题。git 问题可能是由此引起的,Perl 对语言环境的抱怨也很可能由此引起。具体来说,Perl 的抱怨可能是由于软件包locales
处于无法运行的状态,无法dpkg --configure locales
(无法dpkg-reconfigure
)或apt-get -f install
无法修复。
运行apt-get -f install
。如果此操作不能解决问题,请发布apt-get -f install
出现的错误消息。
答案3
我最近遇到了同样的问题,以下修复了区域设置警告
locale-gen en_US.UTF-8
将 en_US.UTF-8 更改为您想要使用的任何语言环境!恐怕我无法帮助您解决 git 问题。:/ 也许您可以在语言环境修复后重新安装它(只是猜测)