脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - 离线安装python的requests库方法

离线安装python的requests库方法

2022-09-16 11:05A_manda Python

大家好,本篇文章主要讲的是离线安装python的requests库方法,感兴趣的同学赶快来看一看吧,对你有帮助的话记得收藏一下

前言

本文详细记录了在win7中离线安装python requests的过程,包括安装requests所需依赖包。

环境:win7、python3.8.9(win7中可安装的最新python版本)、无法连接互联网

 

1、下载安装包

1.1 检查requests模块所需依赖包

在可以上网且已经安装python的机器上检查requests模块需要哪些依赖包,如果这些依赖包未安装,直接安装requests也不能使用。

使用命令:

pip show requests

离线安装python的requests库方法

发现需要chardet,idna,urllib3,certifi

检查这几个包是否已安装,如果未安装,则也需要手工安装。

1.2 下载requests所需依赖包

在网站https://www.lfd.uci.edu/~gohlke/pythonlibs上找到相应的程序,下载并传输至目标机器。

离线安装python的requests库方法

1.3 下载requests包

从github下载requests源码包并传输至目标机器。

https://github.com/kennethreitz/requests

离线安装python的requests库方法

将requests-master.zip解压到python的安装目录中

离线安装python的requests库方法

 

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的requests库方法

输入命令开始安装

python setup.py install

 

3、检查是否安装成功

在python中使用import requests查看

 

总结

到此这篇关于离线安装python的requests库方法的文章就介绍到这了,更多相关python requests库离线安装内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/A_manda/article/details/122817559

延伸 · 阅读

精彩推荐
  • Pythonpython批量生成身份证号到Excel的两种方法实例

    python批量生成身份证号到Excel的两种方法实例

    这篇文章主要给大家介绍了关于python批量生成身份证号到Excel的两种方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习...

    有风南来11142021-08-25
  • Python用Python写脚本,实现完全备份和增量备份的示例

    用Python写脚本,实现完全备份和增量备份的示例

    下面小编就为大家分享一篇用Python写脚本,实现完全备份和增量备份的示例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...

    huangyingleo8902021-02-07
  • Pythonwindows10下python3.5 pip3安装图文教程

    windows10下python3.5 pip3安装图文教程

    这篇文章主要为大家详细介绍了windows10下python3.5 pip3安装图文教程,注意区分python 2.x和python 3.x的相关命令,具有一定的参考价值,感兴趣的小伙伴们可以参...

    唯依weiyi18332021-01-27
  • PythonPython实现批量下载图片的方法

    Python实现批量下载图片的方法

    这篇文章主要介绍了Python实现批量下载图片的方法,涉及Python基于urllib、urllib2及re等模块获取URL及正则匹配下载图片的技巧,具有一定参考借鉴价值,需要的朋...

    沉淀岁月14562020-07-20
  • PythonPython3 Random模块代码详解

    Python3 Random模块代码详解

    这篇文章主要介绍了Python3 Random模块代码详解,具有一定参考价值,需要的朋友可以了解下。...

    llenfeng335662020-12-21
  • PythonTensorFlow数据输入的方法示例

    TensorFlow数据输入的方法示例

    这篇文章主要介绍了TensorFlow数据输入的方法示例,主要介绍了4种方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看...

    黑暗星球7192021-03-06
  • Pythonpython调用fortran模块

    python调用fortran模块

    本文给大家介绍的是在Python中调用fortran代码,主要是用到了f2py这个程序,十分的实用,有需要的小伙伴可以参考下 ...

    Python教程网6172020-08-18
  • PythonPython中使用Inotify监控文件实例

    Python中使用Inotify监控文件实例

    这篇文章主要介绍了Python中使用Inotify监控文件实例,本文直接给出实现代码,需要的朋友可以参考下 ...

    junjie5902019-11-20