【问题标题】:How to install python3-pip on ubuntu 20.04如何在 ubuntu 20.04 上安装 python3-pip
【发布时间】:2020-09-30 16:47:18
【问题描述】:

我在 PC 上安装了 Ubuntu 20.04。然后我尝试开始并为 python3 安装 pip。然而,似乎没有任何工作。 这是我迄今为止尝试过的:

sudo apt install python3-pip

这是我得到的错误:

Reading package lists... Done
Building dependency tree       
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

我已经尝试了 Carlos Sanchez JR 提出的解决方案: How to install Python package installer PIP on Ubuntu 20.04 Linux

按照上面链接中给出的建议后,我在执行sudo apt update 时遇到了这个错误:

Ign:1 cdrom://Ubuntu 20.04 LTS _Focal Fossa_ - Release amd64 (20200423) focal InRelease
Hit:2 cdrom://Ubuntu 20.04 LTS _Focal Fossa_ - Release amd64 (20200423) focal Release
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease              
Hit:6 http://archive.ubuntu.com/ubuntu focal InRelease                        
Get:5 http://kali.download/kali kali-rolling InRelease [30.5 kB]
Hit:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Err:5 http://kali.download/kali kali-rolling InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
Get:8 http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease [30.5 kB]
Err:8 http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
Reading package lists... Done
W: GPG error: http://kali.download/kali kali-rolling InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
E: The repository 'http://http.kali.org/kali kali-rolling InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6
E: The repository 'http://kali.cs.nctu.edu.tw/kali kali-rolling InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

此时尝试sudo apt install python3-pip 只会给我与以前相同的E: Package 'python3-pip' has no installation candidate 错误。

我没有找到解决此问题的其他方法。

【问题讨论】:

标签: python linux ubuntu pip ubuntu-20.04


【解决方案1】:

试试这个命令

sudo apt-get install python3-pip

注意:如果您有全新安装,则需要先执行此操作,然后再尝试上述命令。

sudo apt-get update

【讨论】:

  • 我试过这个。它给了我一个错误。我最终只是安装了另一个版本的 Ubuntu。现在它工作得很好。
  • 这为我解决了问题。我已经运行了更新,但我想我需要再次运行它。
【解决方案2】:

这可能有效:

python3 -m pip3 install -U pip3

或:

python3 -m pip install -U pip

【讨论】:

  • 我试过这个。它给了我一个错误。我最终只是安装了另一个版本的 Ubuntu。现在它工作得很好。
【解决方案3】:

我在Ubuntu 19.04 上遇到了几乎相同的问题。似乎此版本的存储库与 sudo apt update 存在问题...无法解析的 IP 地址和存储库

当我在 vm 中执行此操作时,我安装了 Ubuntu 16.04,一切正常运行,没有任何问题。

按照这些步骤https://docs.python-guide.org/starting/install3/linux/

然后就可以了。

sudo apt install python3-pip

【讨论】:

    【解决方案4】:

    我在 AWS EC2 上遇到了同样的问题。 一个简单的sudo apt update 就解决了这个问题。

    【讨论】:

    • 如果您阅读完整的问题(以及提供的链接),您会发现这是我尝试过的事情之一。回想起来,我认为这可能是某种硬件问题。
    • sudo apt update 在 AWS 上的新 Ubuntu Server 20.04 实例上为我修复了它。
    【解决方案5】:

    方法一:

    要安装 pip,请使用 curl 安全地下载 get-pip.py:

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    

    然后在你下载get-pip.py的文件夹中运行以下命令:

    python get-pip.py
    

    警告如果您使用由您的操作系统或其他包管理器管理的 Python 安装,请务必小心。 get-pip.py 不与这些工具协调,可能会使您的系统处于不一致的状态。


    方法二:

    谨慎使用这种方法,但它对我有用:

    cd ~
    rm -rf .local
    rm -rf .cache
    sudo apt get python3-pip
    

    【讨论】:

      【解决方案6】:

      尝试以下命令:

      sudo apt-get install python3-setuptools
      sudo python3 -m easy_install install pip
      python3 -m pip --version
      

      【讨论】:

      • 这是现场 cd 的唯一方式。 apt update 在 cdrom://... 没有任何内容,并且 python3-pip 尚未准备好。但是 setuptools 和 easy_install 可以让 pip3 工作
      • 这对我有用。
      • 这很好用!
      【解决方案7】:

      您需要启用 Universe 存储库才能为此安装官方包。

      $ sudo add-apt-repository universe
      $ sudo apt-get install python3-pip
      

      【讨论】:

        【解决方案8】:

        这意味着你有一个全新的安装。

        试试这个:

        sudo apt-get update 
        

        然后只需使用以下命令,它就可以正常工作了。

        sudo apt-get install python3-setuptools
        sudo python3 -m easy_install install pip
        python3 -m pip --version
        

        【讨论】:

          【解决方案9】:

          来自 apt-get 更新的错误信息。这是由 kali apt 源引起的。 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ED444FF07D8D0BF6

          您可以先运行以下命令

          wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add
          

          apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys ED444FF07D8D0BF6
          dpkg --configure -a
          

          然后您可以运行以下命令来安装 pip。

          sudo apt-get update
          sudo apt install python3-pip
          

          【讨论】:

            猜你喜欢
            • 2021-04-15
            • 2021-10-17
            • 1970-01-01
            • 2020-09-19
            • 2021-01-25
            • 2021-03-22
            • 2020-10-10
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多