如何在Ubuntu 20.04上安装python3-pip

时间:2020-06-11 05:28:44

标签: python linux ubuntu pip ubuntu-20.04

我在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错误。

我没有找到其他解决方案。

9 个答案:

答案 0 :(得分:3)

尝试此命令

public class MyCanvas extends View { private float cx, cy; private boolean buttonState2; ... public void setResults(float xResult, float yResult) { cx = xResult; cy = yResult; } public void setButtonState(boolean state) { buttonState2 = state; } }

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

public class MainActivity extends AppCompatActivity { private MyCanvas myCanvas; ... public void btnCalcularOnClick(View v){ TextView xResultado = (TextView)findViewById(R.id.xResultado); TextView yResultado = (TextView)findViewById(R.id.yResultado); EditText txtX= (EditText)findViewById(R.id.txtX); EditText txtY= (EditText)findViewById(R.id.txtY); //Comeco da Matematica float x = Float.parseFloat(txtX.getText().toString()); float y = Float.parseFloat(txtY.getText().toString()); float xResult = 5 * x; float yResult = 35 * y; boolean buttonState = true myCanvas.setResults(xResult, yResult); myCanvas.setButtonState(buttonState); } }

答案 1 :(得分:1)

尝试以下命令:

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

答案 2 :(得分:0)

这可能有效:

python3 -m pip3 install -U pip3

或:

python3 -m pip install -U pip

答案 3 :(得分:0)

我在sudo apt update上遇到了几乎相同的问题。似乎此版本的存储库出现sudo apt install python3-pip ... ip地址和存储库无法解决的问题

在虚拟机中进行此操作时,我安装了Ubuntu 16.04,并且一切正常进行,没有问题。

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

然后这行得通。

UserCategories

答案 4 :(得分:0)

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

答案 5 :(得分:0)

方法1:

要安装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与这些工具不协调,可能会使您的系统处于不一致状态。


方法2:

谨慎使用此方法,但对我有用:

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

答案 6 :(得分:0)

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

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

答案 7 :(得分:0)

这意味着您进行了全新安装。

试试这个:

sudo apt-get update 

然后使用下面的命令,它工作正常。

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

答案 8 :(得分:0)

来自 apt-get 更新的错误信息。这是由 kali apt 源引起的。 var appIdGenerator = read('classpath:my-function.js'); config.appHeader = { 'Req-Id': appIdGenerator() };

您可以首先运行以下命令

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

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

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