1. 直接安装报依赖错误

直接使用 apt-get install python3-pip 安装

sudo apt-get install python3-pip

报以下依赖错误

ubuntu@ubuntu:~/src$ sudo apt-get 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 (= 1.5.4-1ubuntu4) but 8.1.1-2ubuntu0.4 is to be installed
               Depends: python3-setuptools but it is not going 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.
ubuntu@ubuntu:~/src$ 

2. 解决方法

下载源码安装

 wget https://bootstrap.pypa.io/get-pip.py
 sudo python3 get-pip.py 

3. 验证是否安装成功

pip3 -V
ubuntu@ubuntu:~/src$  pip3 --version
pip 20.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
ubuntu@ubuntu:~/src$  pip3 -V
pip 20.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
ubuntu@ubuntu:~/src$
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐