我无法找到包 python-pip:
Reading package lists... Done
Building dependency tree Reading state information... Done
E: Unable to locate package python3-pip
如何解决这个问题?
对于 Ubuntu 18.04 (Bionic Beaver),使用 Python 3.6.5,
python-pip
软件包将在以下时间安装:
sudo add-apt-repository universe
sudo apt-get update
这启用了类别
universe
deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe
全新安装 Ubuntu 18.04(通过 Vagrant)后,以下内容已成功安装,没有任何问题:
sudo apt-get update
sudo apt-get install -y python3-pip
请注意,今天下载的 Ubuntu 18.04 附带安装了 Python 3.6.8。这可能会根据您阅读本文的时间而有所不同。
先更新,然后安装python3-pip。所以下面的两个命令应该可以工作。
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install python3-pip
第一次运行
sudo apt-get upgrade
。如果您看到 ppa:未找到某些存储库示例 launchpad.net 或未找到 IP 地址,请转到
软件和更新,然后取消标记导致错误的存储库。然后选择Ubuntu主服务器,重新加载并运行命令
sudo apt-get update
sudo apt-get autoremove
sudo apt-get autoclean
它将删除不需要的现有包并清除缓存,然后 尝试
sudo apt-get update
sudo apt-get install -y python3-pip
您必须清除不需要的存储库的
code /etc/apt/sources.list
或 gedit /etc/apt/sources.list
。或者另一个选择是切换Ubuntu镜像;请参阅如何更改 ubuntu 镜像
sudo apt-get update; sudo apt-get install python3-pip;
这些命令对我有用:
sudo apt-get install python3-setuptools
sudo easy_install3 pip
这是安装 pip 的旧方法,对于旧版本的 Ubuntu 特别有用。 但对我来说仍然很好用。
另一种方法是直接将 universe 类别添加到当前 sources.list 文件中:
vi /etc/apt/sources.list
然后在每行末尾添加 universe 类别:
deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe