离线安装python的requests库方法
程序员文章站
2022-03-02 12:28:54
目录前言1、下载安装包1.1 检查requests模块所需依赖包1.2 下载requests所需依赖包1.3 下载requests包2、安装2.1 安装requests所需依赖包2.2 安装reque...
前言
本文详细记录了在win7中离线安装python requests的过程,包括安装requests所需依赖包。
环境:win7、python3.8.9(win7中可安装的最新python版本)、无法连接互联网
1、下载安装包
1.1 检查requests模块所需依赖包
在可以上网且已经安装python的机器上检查requests模块需要哪些依赖包,如果这些依赖包未安装,直接安装requests也不能使用。
使用命令:
pip show requests
发现需要chardet,idna,urllib3,certifi
检查这几个包是否已安装,如果未安装,则也需要手工安装。
1.2 下载requests所需依赖包
在网站 https://www.lfd.uci.edu/~gohlke/pythonlibs 上找到相应的程序,下载并传输至目标机器。
1.3 下载requests包
从github下载requests源码包并传输至目标机器。
https://github.com/kennethreitz/requests
将requests-master.zip解压到python的安装目录中
2、安装
2.1 安装requests所需依赖包
安装命令为
pip install xx.whl
下图中最后一个是正常安装成功,前面三个有报错信息,目前暂时忽略,因为经过验证没有影响requests安装。
d:\python-lib>pip install urllib3-1.26.8-py2.py3-none-any.whl processing d:\python-lib\urllib3-1.26.8-py2.py3-none-any.whl installing collected packages: urllib3 error: after october 2020 you may experience errors when installing or updating packages. this is because pip will change the way that it resolves dependency conflicts. we recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. requests 2.25.1 requires certifi>=2017.4.17, which is not installed. requests 2.25.1 requires chardet<5,>=3.0.2, which is not installed. requests 2.25.1 requires idna<3,>=2.5, which is not installed. successfully installed urllib3-1.26.8 d:\python-lib>pip install chardet-4.0.0-py3-none-any.whl processing d:\python-lib\chardet-4.0.0-py3-none-any.whl installing collected packages: chardet error: after october 2020 you may experience errors when installing or updating packages. this is because pip will change the way that it resolves dependency co nflicts. we recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. requests 2.25.1 requires certifi>=2017.4.17, which is not installed. requests 2.25.1 requires idna<3,>=2.5, which is not installed. successfully installed chardet-4.0.0 d:\python-lib>pip install certifi-2019.11.28-py2.py3-none-any.whl processing d:\python-lib\certifi-2019.11.28-py2.py3-none-any.whl installing collected packages: certifi error: after october 2020 you may experience errors when installing or updating packages. this is because pip will change the way that it resolves dependency co nflicts. we recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. requests 2.25.1 requires idna<3,>=2.5, which is not installed. successfully installed certifi-2019.11.28 d:\python-lib>pip install idna-2.8-py2.py3-none-any.whl processing d:\python-lib\idna-2.8-py2.py3-none-any.whl installing collected packages: idna successfully installed idna-2.8 d:\python-lib>
2.2 安装requests
在解压好的equests-master目录下打开cmd(或者cmd中切换目录至该路径)
输入命令开始安装
python setup.py install
3、检查是否安装成功
在python中使用import requests查看
总结
到此这篇关于离线安装python的requests库方法的文章就介绍到这了,更多相关python requests库离线安装内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
推荐阅读
-
Python机器学习之scikit-learn库中KNN算法的封装与使用方法
-
oracle数据库不需要安装客户端就能通过vs链接数据库的方法
-
Ubuntu18.04一次性升级Python所有库的方法步骤
-
在sqlserver2005中安装sql server 2000的示例数据库northwind的方法
-
CentOS 7.4下安装Oracle 11.2.0.4数据库的方法
-
ubuntu下安装Python多版本的方法及注意事项
-
C#简单访问SQLite数据库的方法(安装,连接,查询等)
-
Python使用cx_Freeze库生成msi格式安装文件的方法
-
python库lxml在linux和WIN系统下的安装
-
详解windows python3.7安装numpy问题的解决方法