离线安装pip
下载pip的源代码:https://pypi.org/project/pip/
根据兼容性,找到python2.7兼容的版本20.3.4的源码:pip-20.3.4.tar.gz
1.拷贝到服务器
2.修改权限命令:chmod 755 pip-20.3.4.tar.gz
3.运行解压命令:tar -xvf pip-20.3.4.tar.gz
4.切换到pip-20.3.4目录下,运行安装命令:python setup.py install
离线安装第三方库
A机器下载安装包:
vi requirements.txt,输入下面依赖,再运行下载命令:
click==7.1.2
Flask==1.1.4
Jinja2==2.11.3
Werkzeug==1.0.1
wheel==0.37.1
MarkupSafe==1.1.1
itsdangerous==1.1.0
pip download -r requirements.txt -d .
将所有whl文件和requirements.txt一起拷贝到B机器的3rd文件夹下。
pip install --no-index --find-links=./ -r requirements.txt
安装结果:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Looking in links: ./
Processing ./click-7.1.2-py2.py3-none-any.whl
Processing ./Flask-1.1.4-py2.py3-none-any.whl
Processing ./Jinja2-2.11.3-py2.py3-none-any.whl
Processing ./Werkzeug-1.0.1-py2.py3-none-any.whl
Processing ./wheel-0.37.1-py2.py3-none-any.whl
Processing ./MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Processing ./itsdangerous-1.1.0-py2.py3-none-any.whl
Installing collected packages: click, itsdangerous, MarkupSafe, Jinja2, Werkzeug, Flask, wheel
Successfully installed Flask-1.1.4 Jinja2-2.11.3 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.2 itsdangerous-1.1.0 wheel-0.37.1
网友评论