安装 request模块

python3 requests 安装包下载安装[windows]

听语音
  • |
  • 浏览:54
  • |
  • 更新:2016-07-25 17:09

windows下直接使用:easy_install requests或者pip install requests来安装总是报错:要么找不到安装包,要么timedout。总之一个不爽。现在还是介绍下载离线源码手动安装的方法。

工具/原料

 
  • python 3运行环境[windows]

方法/步骤

 
  1.  

    1. 在http://cn.python-requests.org/zh_CN/latest/user/install.html#pip-install-requests 页面找到”也可以下载 tarball:“超链接( https://github.com/kennethreitz/requests/tarball/master ),右键》链接另存为 下载安装包“kennethreitz-requests-v2.10.0-63-gfb01456.tar.gz”。

  2.  

    2. 用WinRAR等解压其中的kennethreitz-requests-fb01456到Python 3安装目录 d:\Programs\Python\Python35-32\kennethreitz-requests-fb01456\。

  3.  

    3. 开始》运行》cmd打开一个命令行窗口,依次输入以下三个命令:

    d:

    cd d:\Programs\Python\Python35-32\kennethreitz-requests-fb01456>

    d:\Programs\Python\Python35-32\kennethreitz-requests-fb01456>..\python setup.py install

    其中:

    第一个命令切换当前目录到D盘

    第二个命令切换当前目录到下载解压的requests在Python3安装的位置

    第三个命令调用父目录下的python.exe执行requests的安装脚本即setup.py,参数是install

  4.  

    安装完成的部分提示:

    creating build\bdist.win32\egg\EGG-INFO

    copying requests.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO

    copying requests.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO

    copying requests.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO

     

    copying requests.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFO

    copying requests.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO

    copying requests.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO

    creating dist

    creating 'dist\requests-2.10.0-py3.5.egg' and adding 'build\bdist.win32\egg' to

    it

    removing 'build\bdist.win32\egg' (and everything under it)

    Processing requests-2.10.0-py3.5.egg

    creating d:\programs\python\python35-32\lib\site-packages\requests-2.10.0-py3.5.

    egg

    Extracting requests-2.10.0-py3.5.egg to d:\programs\python\python35-32\lib\site-

    packages

    Adding requests 2.10.0 to easy-install.pth file

     

    Installed d:\programs\python\python35-32\lib\site-packages\requests-2.10.0-py3.5

    .egg

    Processing dependencies for requests==2.10.0

    Finished processing dependencies for requests==2.10.0

  5. 5

    在IDLE中输入import requests,如果没提示错误,那说明已经安装成功了!

posted @ 2016-09-09 18:07  任飞儿  阅读(3351)  评论(0编辑  收藏  举报