在 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

相關內容