方式一、pip工具在线安装
pip install requests
方式二、离线包安装
[root@localhost ~]# wget https://pypi.python.org/packages/5b/0b/34be574b1ec997247796e5d516f3a6b6509c4e064f2885a96ed885ce7579/requests-2.12.4.tar.gz
tar -zxvf requests-2.12.4.tar.gzcd setuptools-41.1.0.post1/
[root@localhost ~]# cd requests-2.12.4
python setup.py install
测试是否安装成功
[root@localhost requests-2.12.4]# python
Python 2.7.5 (default, Oct 14 2020, 14:45:30)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> exit()
>```