如何更新 pip3 子版本?

如何更新 pip3 子版本?

我最近将我的 Ubuntu 服务器从 15.04 升级到了 16.04 LTS。在此过程中,安装了 Python 3.5。但是,出于某种原因,它附带的 pip3 版本显然想要使用 Python 3.4,而不是 Python 3.5。

这是我看到的错误:

-bash:/usr/local/bin/pip3:/usr/bin/python3.4:错误的解释器:没有此文件或目录

如何安装适当版本的 pip 以与我的 python 3.5 安装一起使用?

以下是我安装的python包(通过以下方式找到sudo apt list --installed | grep python):

dh-python/xenial-updates,xenial-updates,now 2.20151103ubuntu1.1 all [installed,automatic]
libpython-stdlib/xenial,now 2.7.11-1 amd64 [installed]
libpython2.7/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
libpython2.7-minimal/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
libpython2.7-stdlib/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
libpython3-stdlib/xenial,now 3.5.1-3 amd64 [installed]
libpython3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
libpython3.5-minimal/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
libpython3.5-stdlib/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
python/xenial,now 2.7.11-1 amd64 [installed]
python-apt/xenial,now 1.1.0~beta1build1 amd64 [installed]
python-apt-common/xenial,xenial,now 1.1.0~beta1build1 all [installed]
python-attr/xenial,xenial,now 15.2.0-1 all [installed,automatic]
python-cffi-backend/xenial,now 1.5.2-1ubuntu1 amd64 [installed,automatic]
python-characteristic/xenial,xenial,now 14.3.0-1 all [installed]
python-chardet/xenial,xenial,now 2.3.0-2 all [installed]
python-configobj/xenial,xenial,now 5.0.6-2 all [installed]
python-cryptography/xenial-updates,xenial-security,now 1.2.3-1ubuntu0.1 amd64 [installed,automatic]
python-debian/xenial,xenial,now 0.1.27ubuntu2 all [installed]
python-enum34/xenial,xenial,now 1.1.2-1 all [installed,automatic]
python-gdbm/xenial,now 2.7.11-2 amd64 [installed]
python-idna/xenial,xenial,now 2.0-3 all [installed]
python-ipaddress/xenial,xenial,now 1.0.16-1 all [installed,automatic]
python-minimal/xenial,now 2.7.11-1 amd64 [installed]
python-openssl/xenial,xenial,now 0.15.1-2build1 all [installed]
python-pam/xenial,now 0.4.2-13.2ubuntu2 amd64 [installed]
python-pkg-resources/xenial,xenial,now 20.7.0-1 all [installed]
python-pyasn1/xenial,xenial,now 0.1.9-1 all [installed]
python-pyasn1-modules/xenial,xenial,now 0.0.7-0.1 all [installed]
python-serial/xenial,xenial,now 3.0.1-1 all [installed]
python-service-identity/xenial,xenial,now 16.0.0-2 all [installed]
python-six/xenial,xenial,now 1.10.0-3 all [installed]
python-twisted-bin/xenial,now 16.0.0-1 amd64 [installed]
python-twisted-core/xenial,xenial,now 16.0.0-1 all [installed]
python-zope.interface/xenial,now 4.1.3-1build1 amd64 [installed]
python2.7/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
python2.7-minimal/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
python3/xenial,now 3.5.1-3 amd64 [installed]
python3-minimal/xenial,now 3.5.1-3 amd64 [installed,automatic]
python3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
python3.5-minimal/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]

答案1

我下载了get-pip.py脚本,并用 python3.5 运行它。这样做似乎让事情变得清晰起来。

相关内容