ubuntu20.04 LTS 离线安装pip
2021-03-04 本文已影响0人
blair_liu
ubuntu20.04 LTS 默认已有python3.8.2
测试命令:
python3 -V
结果:
Python 3.8.2
严格按照以下步骤安装
1、安装python3-distutils
在
https://pkgs.org/
搜索python3-distutils

依赖关系

根据依赖关系需要下载两个deb
http://archive.ubuntu.com/ubuntu/pool/main/p/python3-stdlib-extensions/python3-distutils_3.8.2-1ubuntu1_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/p/python3-stdlib-extensions/python3-lib2to3_3.8.2-1ubuntu1_all.deb
下载好后放到一个路径下

该路径下:
sudo dpkg -i *.deb

注:如果未进行此步骤,则
ModuleNotFoundError: No module named 'distutils.core'

2、安装setuptools
从https://pypi.org/搜索setuptools,然后点Download files

解压:
tar -zxvf setuptools-54.0.0.tar.gz
进入文件夹
sudo python3 setup.py install
注:如果未进行此步骤,则
ModuleNotFoundError: No module named 'setuptools'

3、安装pip
从https://pypi.org/搜索pip,然后点Download files

解压:
tar -zxvf pip-21.0.1.tar.gz
进入文件夹
sudo python3 setup.py install
安装结束
安装后测试
pip list