2020-07-02 离线安装python 2.7的requests模块

requests 是 Python 的一个 HTTP 客户端库,跟 urllib,urllib2 类似,不过 requests 的优势在于使用简单,相同一个功能,用 requests 实现起来代码量要少很多。毕竟官方文档都很直白的说:

python 的标准库 urllib2 提供了大部分需要的 HTTP 功能,但是 API 太逆天了,一个简单的功能就需要一大堆代码。

所以,使用 requests 方便的多。

官方包下载地址: https://pypi.org/project/requests/#files

安装过程参考地址: https://www.cnblogs.com/Javi/p/9151629.html
复杂版: https://blog.csdn.net/echojosedream/article/details/52938136

参考pip在线安装

G:\Projects\github\hmac-auth-java-sdk\hmac-auth\jars>pip2 install requests
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Requirement already satisfied: requests in f:\python27\lib\site-packages (2.24.0)
Requirement already satisfied: idna<3,>=2.5 in f:\python27\lib\site-packages (from requests) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in f:\python27\lib\site-packages (from requests) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in f:\python27\lib\site-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in f:\python27\lib\site-packages (from requests) (1.25.9)
WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

下载离线安装包

https://files.pythonhosted.org/packages/da/67/672b422d9daf07365259958912ba533a0ecab839d4084c487a5fe9a5405f/requests-2.24.0.tar.gz

随后解压并准备安装

错误的离线安装命令

F:\Python27\python.exe F:\Programs\requests-2.24.0\requests-2.24.0\setup.py install

报错readme.md找不到

G:\Projects\github\hmac-auth-java-sdk\hmac-auth\jars>F:\Python27\python.exe F:\Programs\requests-2.24.0\requests-2.24.0\setup.py install
Traceback (most recent call last):
  File "F:\Programs\requests-2.24.0\requests-2.24.0\setup.py", line 64, in <module>
    with open('README.md', 'r', 'utf-8') as f:
  File "F:\Python27\lib\codecs.py", line 898, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: 'README.md'

意识到可能是使用了相对路劲去找上述问价,导致找不到,所以打算进入到setup.py所在目录

正确的安装命令

cd  F:\Programs\requests-2.24.0\requests-2.24.0\

F:\Programs\requests-2.24.0\requests-2.24.0>F:\Python27\python.exe setup.py install
running install
running bdist_egg
running egg_info
writing requirements to requests.egg-info\requires.txt
writing requests.egg-info\PKG-INFO
writing top-level names to requests.egg-info\top_level.txt
writing dependency_links to requests.egg-info\dependency_links.txt
reading manifest file 'requests.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'NOTICE'
warning: no files found matching 'requirements.txt'
writing manifest file 'requests.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\requests
copying requests\adapters.py -> build\lib\requests
copying requests\api.py -> build\lib\requests
copying requests\auth.py -> build\lib\requests
copying requests\certs.py -> build\lib\requests
copying requests\compat.py -> build\lib\requests
copying requests\cookies.py -> build\lib\requests
copying requests\exceptions.py -> build\lib\requests
copying requests\help.py -> build\lib\requests
copying requests\hooks.py -> build\lib\requests
copying requests\models.py -> build\lib\requests
copying requests\packages.py -> build\lib\requests
copying requests\sessions.py -> build\lib\requests
copying requests\status_codes.py -> build\lib\requests
copying requests\structures.py -> build\lib\requests
copying requests\utils.py -> build\lib\requests
copying requests\_internal_utils.py -> build\lib\requests
copying requests\__init__.py -> build\lib\requests
copying requests\__version__.py -> build\lib\requests
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\requests
copying build\lib\requests\adapters.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\api.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\auth.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\certs.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\compat.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\cookies.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\exceptions.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\help.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\hooks.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\models.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\packages.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\sessions.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\status_codes.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\structures.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\utils.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\_internal_utils.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\__init__.py -> build\bdist.win-amd64\egg\requests
copying build\lib\requests\__version__.py -> build\bdist.win-amd64\egg\requests
byte-compiling build\bdist.win-amd64\egg\requests\adapters.py to adapters.pyc
byte-compiling build\bdist.win-amd64\egg\requests\api.py to api.pyc
byte-compiling build\bdist.win-amd64\egg\requests\auth.py to auth.pyc
byte-compiling build\bdist.win-amd64\egg\requests\certs.py to certs.pyc
byte-compiling build\bdist.win-amd64\egg\requests\compat.py to compat.pyc
byte-compiling build\bdist.win-amd64\egg\requests\cookies.py to cookies.pyc
byte-compiling build\bdist.win-amd64\egg\requests\exceptions.py to exceptions.pyc
byte-compiling build\bdist.win-amd64\egg\requests\help.py to help.pyc
byte-compiling build\bdist.win-amd64\egg\requests\hooks.py to hooks.pyc
byte-compiling build\bdist.win-amd64\egg\requests\models.py to models.pyc
byte-compiling build\bdist.win-amd64\egg\requests\packages.py to packages.pyc
byte-compiling build\bdist.win-amd64\egg\requests\sessions.py to sessions.pyc
byte-compiling build\bdist.win-amd64\egg\requests\status_codes.py to status_codes.pyc
byte-compiling build\bdist.win-amd64\egg\requests\structures.py to structures.pyc
byte-compiling build\bdist.win-amd64\egg\requests\utils.py to utils.pyc
byte-compiling build\bdist.win-amd64\egg\requests\_internal_utils.py to _internal_utils.pyc
byte-compiling build\bdist.win-amd64\egg\requests\__init__.py to __init__.pyc
byte-compiling build\bdist.win-amd64\egg\requests\__version__.py to __version__.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying requests.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying requests.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying requests.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying requests.egg-info\not-zip-safe -> build\bdist.win-amd64\egg\EGG-INFO
copying requests.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying requests.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
creating dist
creating 'dist\requests-2.24.0-py2.7.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing requests-2.24.0-py2.7.egg
creating f:\python27\lib\site-packages\requests-2.24.0-py2.7.egg
Extracting requests-2.24.0-py2.7.egg to f:\python27\lib\site-packages
Adding requests 2.24.0 to easy-install.pth file

Installed f:\python27\lib\site-packages\requests-2.24.0-py2.7.egg
Processing dependencies for requests==2.24.0
Searching for certifi==2020.6.20
Best match: certifi 2020.6.20
Adding certifi 2020.6.20 to easy-install.pth file

Using f:\python27\lib\site-packages
Searching for urllib3==1.25.9
Best match: urllib3 1.25.9
Adding urllib3 1.25.9 to easy-install.pth file

Using f:\python27\lib\site-packages
Searching for idna==2.10
Best match: idna 2.10
Adding idna 2.10 to easy-install.pth file

Using f:\python27\lib\site-packages
Searching for chardet==3.0.4
Best match: chardet 3.0.4
Adding chardet 3.0.4 to easy-install.pth file
Installing chardetect-script.py script to F:\Python27\Scripts
Installing chardetect.exe script to F:\Python27\Scripts

Using f:\python27\lib\site-packages
Finished processing dependencies for requests==2.24.0
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,324评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,303评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,192评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,555评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,569评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,566评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,927评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,583评论 0 257
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,827评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,590评论 2 320
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,669评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,365评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,941评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,928评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,159评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,880评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,399评论 2 342