在wsl配置中遇到报错:E: Package 'python3-pip' has no installation candidate
~$ python3 --version
Python 3.10.12
~$ which python3
/usr/bin/python3
~$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python3-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python3-pip' has no installation candidate
参考了许多解决方案,不起作用,可参考stackoverflow论坛。
解决方法:
- 更新所有包:
sudo apt update以及sudo apt upgrade - 修复破损的依赖包:
sudo apt --fix-broken install - 清理包缓存:
sudo apt clean以及sudo apt update - 手动安装pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py以及sudo python3 get-pip.py - 安装成功!