安裝 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,如果沒提示錯誤,那說明已經安裝成功了!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM