如何在Ubuntu 18.04中将pip3更新到最新版本?

时间:2018-07-12 03:10:18

标签: python python-3.x pip ubuntu-18.04

运行时出现此错误

$ pip3 install -U pip

Requirement already up-to-date: pip in ./dlenv/lib/python3.6/site-packages (10.0.1)
launchpadlib 1.10.6 requires testresources, which is not installed.

我已经搜索了apt,并且testresources似乎已经安装。

apt search testresources
Sorting... Done
Full Text Search... Done
python-testresources/bionic,bionic 2.0.0-2 all
  PyUnit extension for managing expensive test fixtures - Python 2.x

python3-testresources/bionic,bionic 2.0.0-2 all
  PyUnit extension for managing expensive test fixtures - Python 3.

我已经遍历了这个github issue,但解决方案还不清楚。

3 个答案:

答案 0 :(得分:2)

尝试一下

sudo apt install python3-testresources

答案 1 :(得分:0)

建议在Ubuntu 18.04上通过PyPA guide安装pip,因为如果我们通过sudo apt install python3-pip安装pip版本太旧。

为我工作:

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

# python get-pip.py

顺便说一句,如果找不到PATH,则pip的默认位置为/usr/local/bin/pip

答案 2 :(得分:-2)

尝试一下
sudo apt-get remove python-pip python-dev-这将删除pip和python 然后安装所需版本的python和pip