1、先到官网 http://pypi.python.org/pypi/setuptools 下载setuptools.exe文件并安装
点击 ez_setup.py进入, 并将内容复制下来, 保存为本地的python脚本, 如: easy_install.py, 执行python easy_install.py
2、安装完毕后建议把D:\Python27\Scripts添加到path环境变量,再使用easy_install pip命令安装pip
C:\windows\system32>easy_install pip
Searching for pip
Best match: pip 1.5.6
Processing pip-1.5.6-py2.7.egg
pip 1.5.6 is already the active version in easy-install.pth
Installing pip-script.py script to D:\Python27\Scripts
Installing pip.exe script to D:\Python27\Scripts
Installing pip.exe.manifest script to D:\Python27\Scripts
Installing pip2.7-script.py script to D:\Python27\Scripts
Installing pip2.7.exe script to D:\Python27\Scripts
Installing pip2.7.exe.manifest script to D:\Python27\Scripts
Installing pip2-script.py script to D:\Python27\Scripts
Installing pip2.exe script to D:\Python27\Scripts
Installing pip2.exe.manifest script to D:\Python27\Scripts Using d:\python27\lib\site-packages\pip-1.5.6-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
通过豆瓣源安装python第三方requests类库
C:\windows\system32>pip install requests -i http://pypi.douban.com/simple/
Downloading/unpacking requests
http://pypi.douban.com/simple/requests/ uses an insecure transport scheme (htt
p). Consider using https if pypi.douban.com has it available
Installing collected packages: requests
Successfully installed requests
Cleaning up...
pip的其他用法:
pip install -U 包名(类requests) -- 更新requests类库
pip unintsll 包名(类requests) -- 删除requests类库
pip search 包名(类requests) -- 搜索requests类库
pip help
比如:手动安装requests
- 先下载requests包 https://github.com/kennethreitz/requests
- 解压下载的zip包
- 进入有setup.py 的目录 ,用windows的cmd
- 先执行 python setup.py build
- 然后执行 python setup.py install
- 如果不出什么问题,提示安装成功
- 新建立一个测试项目,import requests