在 Ubuntu 16.04 上安装 python3-pip 时出现“无法安装某些软件包”错误

在 Ubuntu 16.04 上安装 python3-pip 时出现“无法安装某些软件包”错误

当我在 Ubuntu 16.04 上运行命令时sudo apt install python3-pip出现这些错误

Reading package lists... Done
Building dependency tree       
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:
 python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed
               Recommends: python3-dev (>= 3.2) but it is not going to be installed
               Recommends: python3-wheel but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

答案1

只需删除python-pip-whl包并重试:

sudo apt-get remove python-pip-whl

答案2

经过大量搜索后,我终于能够通过运行以下命令在我的 Ubuntu 16.04 机器上安装 pip3

sudo apt-get install python3-setuptools
sudo easy_install3 pip

答案3

您的包裹已损坏,因此请使用以下步骤:

  1. 修复损坏的软件包:

    sudo apt -f install
    
  2. 更新:

    sudo apt update && sudo apt dist-upgrade
    
  3. 现在正常安装:

    sudo apt install python3-pip
    
  4. 检查是否安装:

    pip3 --version
    

这应该可以解决这个问题。

答案4

经过大量搜索后,这终于对我有用

sudo apt-get install aptitude

然后使用以下命令安装 pip3:

sudo aptitude install python3-pip

相关内容