安装pip
查看python版本
[root@server ~]# python --version
Python 2.7.5
[root@server ~]# python -V
Python 2.7.5
[root@server ~]#
[root@server ~]# pip -V
bash: pip: 未找到命令...
[root@server ~]# pip2 -V
bash: pip2: 未找到命令...
[root@server ~]#
下载:
[root@server ~]# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
--2022-07-06 10:45:58-- https://bootstrap.pypa.io/pip/2.7/get-pip.py
正在解析主机 bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.0.175, 151.101.64.175, 151.101.128.175, ...
正在连接 bootstrap.pypa.io (bootstrap.pypa.io)|151.101.0.175|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1908226 (1.8M) [text/x-python]
正在保存至: “get-pip.py”
100%[================================================================================>] 1,908,226 29.7KB/s 用时 56s
2022-07-06 10:46:55 (33.5 KB/s) - 已保存 “get-pip.py” [1908226/1908226])
[root@server ~]#
安装:
[root@server ~]# python get-pip.py
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.
Collecting pip<21.0
Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 665 kB/s
Collecting wheel
Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, wheel
Successfully installed pip-20.3.4 wheel-0.37.1
[root@server ~]#
查看pip版本:
[root@server ~]# pip --version
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@server ~]# pip -V
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@server ~]#
[root@server ~]# pip2 install requests
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.
Collecting requests
Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
|████████████████████████████████| 63 kB 179 kB/s
Collecting certifi>=2017.4.17
Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
|████████████████████████████████| 149 kB 67 kB/s
Collecting urllib3<1.27,>=1.21.1
Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
|████████████████████████████████| 138 kB 44 kB/s
Collecting idna<3,>=2.5; python_version < "3"
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
|████████████████████████████████| 58 kB 47 kB/s
Collecting chardet<5,>=3.0.2; python_version < "3"
Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
|████████████████████████████████| 178 kB 40 kB/s
Installing collected packages: certifi, urllib3, idna, chardet, requests
Attempting uninstall: chardet
Found existing installation: chardet 2.2.1
Uninstalling chardet-2.2.1:
Successfully uninstalled chardet-2.2.1
Successfully installed certifi-2021.10.8 chardet-4.0.0 idna-2.10 requests-2.27.1 urllib3-1.26.9
[root@server ~]#
加权限:
[root@server ~]# ls
anaconda-ks.cfg get-pip.py initial-setup-ks.cfg start.bin 公共 模板 视频 图片 文档 下载 音乐 桌面
[root@server ~]# chmod 755 start.bin
[root@server ~]# ls
anaconda-ks.cfg get-pip.py initial-setup-ks.cfg start.bin 公共 模板 视频 图片 文档 下载 音乐 桌面
[root@server ~]#
[root@server ~]# python --version
Python 2.7.5
[root@server ~]# python -V
Python 2.7.5
[root@server ~]#
[root@server ~]# pip -V
bash: pip: 未找到命令...
[root@server ~]# pip2 -V
bash: pip2: 未找到命令...
[root@server ~]#
下载:
[root@server ~]# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
--2022-07-06 10:45:58-- https://bootstrap.pypa.io/pip/2.7/get-pip.py
正在解析主机 bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.0.175, 151.101.64.175, 151.101.128.175, ...
正在连接 bootstrap.pypa.io (bootstrap.pypa.io)|151.101.0.175|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1908226 (1.8M) [text/x-python]
正在保存至: “get-pip.py”
100%[================================================================================>] 1,908,226 29.7KB/s 用时 56s
2022-07-06 10:46:55 (33.5 KB/s) - 已保存 “get-pip.py” [1908226/1908226])
[root@server ~]#
安装:
[root@server ~]# python get-pip.py
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.
Collecting pip<21.0
Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 665 kB/s
Collecting wheel
Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, wheel
Successfully installed pip-20.3.4 wheel-0.37.1
[root@server ~]#
查看pip版本:
[root@server ~]# pip --version
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@server ~]# pip -V
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@server ~]#
[root@server ~]# pip2 install requests
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.
Collecting requests
Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
|████████████████████████████████| 63 kB 179 kB/s
Collecting certifi>=2017.4.17
Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
|████████████████████████████████| 149 kB 67 kB/s
Collecting urllib3<1.27,>=1.21.1
Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
|████████████████████████████████| 138 kB 44 kB/s
Collecting idna<3,>=2.5; python_version < "3"
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
|████████████████████████████████| 58 kB 47 kB/s
Collecting chardet<5,>=3.0.2; python_version < "3"
Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
|████████████████████████████████| 178 kB 40 kB/s
Installing collected packages: certifi, urllib3, idna, chardet, requests
Attempting uninstall: chardet
Found existing installation: chardet 2.2.1
Uninstalling chardet-2.2.1:
Successfully uninstalled chardet-2.2.1
Successfully installed certifi-2021.10.8 chardet-4.0.0 idna-2.10 requests-2.27.1 urllib3-1.26.9
[root@server ~]#
加权限:
[root@server ~]# ls
anaconda-ks.cfg get-pip.py initial-setup-ks.cfg start.bin 公共 模板 视频 图片 文档 下载 音乐 桌面
[root@server ~]# chmod 755 start.bin
[root@server ~]# ls
anaconda-ks.cfg get-pip.py initial-setup-ks.cfg start.bin 公共 模板 视频 图片 文档 下载 音乐 桌面
[root@server ~]#
本文来自博客园,作者:花之旭,转载请注明原文链接:https://www.cnblogs.com/huazhixu/p/16450194.html