在 Windows 上安装 Git 后,WSL 看不到它。使用时apt-get install git
出现以下错误:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
git : Depends: libc6 (>= 2.38) but 2.31-13+deb11u9 is to be installed
Recommends: ssh-client
E: Unable to correct problems, you have held broken packages.
当我尝试时apt-get install libc6=2.38
我得到
Version '2.38' for 'libc6' was not found
这是之后
apt-get update
apt-get upgrade
apt-get clean
apt-get autoclean
dpkg --configure -a
apt-get -f install
这是在 Windows 10 上使用 Debian 全新安装的 WSL。
我在网上找到的唯一解决方案是针对 Ubuntu Linux 系统并且涉及升级 libc6 或类似软件,与安装 git 和未满足的依赖问题无关。
答案1
已解决我能够通过这个答案找到解决方案:https://askubuntu.com/a/223267/334075
我安装了 aptitude,然后用它来安装 git。
Aptitude 做了更多工作来寻找未满足的依赖关系的解决方案,它提出的第二个解决方案是安装不依赖于高版本 libc6 的旧版本 git。