码迷,mamicode.com
首页 > 编程语言 > 详细

python安装第三方类库的方法

时间:2015-05-16 18:11:23      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

1、先到官网 http://pypi.python.org/pypi/setuptools 下载setuptools.exe文件并安装
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

  1. 先下载requests包  https://github.com/kennethreitz/requests
  2. 解压下载的zip包
  3. 进入有setup.py 的目录 ,用windows的cmd
  4. 先执行 python setup.py build
  5. 然后执行 python setup.py install
  6. 如果不出什么问题,提示安装成功
  7. 新建立一个测试项目,import requests 

python安装第三方类库的方法

标签:

原文地址:http://www.cnblogs.com/dtest/p/4507980.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!