我sudo apt-get install python-pip
从终端运行。但出现以下错误:-
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
当我从终端运行命令时sudo apt-get install python-setuptools python-dev build-essential.
,出现以下错误:-
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-setuptools
E: Unable to locate package python-dev
E: Unable to locate package build-essential.
E: Couldn't find any package by glob 'build-essential.'
E: Couldn't find any package by regex 'build-essential.'
我该如何解决这个问题?
答案1
似乎所有 Ubuntu 存储库(、、、main
)均未启用。这就是您收到错误的原因。为此,请从终端运行以下命令(逐个):-universe
restricted
multiverse
Unable to locate <package>
sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
sudo apt update
另外,在第二个命令中,即sudo apt-get install python-setuptools python-dev build-essential.
,您没有正确命名包build-essential
。因此您收到此错误:-
E: Couldn't find any package by glob 'build-essential.'
E: Couldn't find any package by regex 'build-essential.'
您可以使用不同的方法来安装点子在 Ubuntu 17.10 中。为此,请从终端运行以下命令(逐个):-
sudo apt install curl
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
sudo python3 /tmp/get-pip.py
pip install --user pipenv
echo "PATH=$HOME/.local/bin:$PATH" >> ~/.profile
source ~/.profile
参考
答案2
您是否已下载 apt 软件包注册表?请确保以 开头$ sudo apt update
,确认可以使用以下命令获取软件包更新$ sudo apt update -y
另外,请确保您的系统没有损坏。也许发布您的错误消息? 无法安装 python-pip