windows下直接使用:easy_install requests或者pip install requests来安装总是报错:要么找不到安装包,要么timedout。总之一个不爽。现在还是介绍下载离线源码手动安装的方法。
标签:
windows下直接使用:easy_install requests或者pip install requests来安装总是报错:要么找不到安装包,要么timedout。总之一个不爽。现在还是介绍下载离线源码手动安装的方法。
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. 用WinRAR等解压其中的kennethreitz-requests-fb01456到Python 3安装目录 d:\Programs\Python\Python35-32\kennethreitz-requests-fb01456\。
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
安装完成的部分提示:
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
在IDLE中输入import requests,如果没提示错误,那说明已经安装成功了!
标签:
原文地址:http://www.cnblogs.com/mmbbflyer/p/5857635.html