Python安装第三方库的3种方法


Posted in Python onJune 21, 2015

【方法一】: 通过setuptools来安装python模块

首先下载 http://peak.telecommunity.com/dist/ez_setup.py

NOTE: 最好下载个setuptools,本人是15.2版本,里面包含了ez_setup

运行 python ez_setup.py

D:\work\installation\setuptools-15.2\setuptools-15.2>python ez_setup.py > 1.txt 
Extracting in c:\users\admini~1\appdata\local\temp\tmpbxikxf 
Now working in c:\users\admini~1\appdata\local\temp\tmpbxikxf\setuptools-15.2 
Installing Setuptools 
...... 
Copying setuptools-15.2-py2.7.egg to c:\python27\lib\site-packages 
setuptools 15.2 is already the active version in easy-install.pth 
Installing easy_install-script.py script to C:\Python27\Scripts 
Installing easy_install.exe script to C:\Python27\Scripts 
Installing easy_install-2.7-script.py script to C:\Python27\Scripts 
Installing easy_install-2.7.exe script to C:\Python27\Scripts 
 
 
Installed c:\python27\lib\site-packages\setuptools-15.2-py2.7.egg 
Processing dependencies for setuptools==15.2 
Finished processing dependencies for setuptools==15.2

运行 easy_install py

D:\work>easy_install py      #py 为第三方库文件 
Searching for py 
Best match: py 1.4.26 
Adding py 1.4.26 to easy-install.pth file 
 
Using c:\python27\lib\site-packages 
Processing dependencies for py 
Finished processing dependencies for py

【方法二】: 通过pip来安装python模块

安装 easy_install pip

D:\work>easy_install pip 
Searching for pip 
Best match: pip 6.1.1 
Processing pip-6.1.1-py2.7.egg 
pip 6.1.1 is already the active version in easy-install.pth 
Installing pip-script.py script to C:\Python27\Scripts 
Installing pip.exe script to C:\Python27\Scripts 
Installing pip2.7-script.py script to C:\Python27\Scripts 
Installing pip2.7.exe script to C:\Python27\Scripts 
Installing pip2-script.py script to C:\Python27\Scripts 
Installing pip2.exe script to C:\Python27\Scripts 
 
Using c:\python27\lib\site-packages\pip-6.1.1-py2.7.egg 
Processing dependencies for pip 
Finished processing dependencies for pip

运行 pip install xlrd

Usage:   
 pip <command> [options] 
 
Commands: 
 install           Install packages. 
 uninstall          Uninstall packages. 
 freeze           Output installed packages in requirements format. 
 list            List installed packages. 
 show            Show information about installed packages. 
 search           Search PyPI for packages. 
 wheel            Build wheels from your requirements. 
 zip             DEPRECATED. Zip individual packages. 
 unzip            DEPRECATED. Unzip individual packages. 
 help            Show help for commands. 
 
General Options: 
 -h, --help         Show help. 
 --isolated         Run pip in an isolated mode, ignoring 
               environment variables and user configuration. 
 -v, --verbose        Give more output. Option is additive, and can be 
               used up to 3 times. 
 -V, --version        Show version and exit. 
 -q, --quiet         Give less output. 
 --log <path>        Path to a verbose appending log. 
 --proxy <proxy>       Specify a proxy in the form 
               [user:passwd@]proxy.server:port. 
 --retries <retries>     Maximum number of retries each connection should 
               attempt (default 5 times). 
 --timeout <sec>       Set the socket timeout (default 15 seconds). 
 --exists-action <action>  Default action when a path already exists: 
               (s)witch, (i)gnore, (w)ipe, (b)ackup. 
 --trusted-host <hostname>  Mark this host as trusted, even though it does 
               not have valid or any HTTPS. 
 --cert <path>        Path to alternate CA bundle. 
 --client-cert <path>    Path to SSL client certificate, a single file 
               containing the private key and the certificate 
               in PEM format. 
 --cache-dir <dir>      Store the cache data in <dir>. 
 --no-cache-dir       Disable the cache. 
 --disable-pip-version-check 
               Don't periodically check PyPI to determine 
               whether a new version of pip is available for 
               download. Implied with --no-index.

【方法三】:直接从网上下载下可执行文件来安装.

比如说,去 >>> pythonlibs <<< 网站,提供了很多Python非官方包下载,二进制文件,下载安装方便.

Python 相关文章推荐
Python实现将n个点均匀地分布在球面上的方法
Mar 12 Python
Python解析xml中dom元素的方法
Mar 12 Python
用Python的pandas框架操作Excel文件中的数据教程
Mar 31 Python
cmd运行python文件时对结果进行保存的方法
May 16 Python
Python版名片管理系统
Nov 30 Python
win7下 python3.6 安装opencv 和 opencv-contrib-python解决 cv2.xfeatures2d.SIFT_create() 的问题
Oct 24 Python
python实现while循环打印星星的四种形状
Nov 23 Python
Python类反射机制使用实例解析
Dec 30 Python
Python列表倒序输出及其效率详解
Mar 04 Python
浅谈Python中range与Numpy中arange的比较
Mar 11 Python
浅谈tf.train.Saver()与tf.train.import_meta_graph的要点
May 26 Python
python小型的音频操作库mp3Play
Apr 24 Python
Python实现线程池代码分享
Jun 21 #Python
Python os模块学习笔记
Jun 21 #Python
Pthon批量处理将pdb文件生成dssp文件
Jun 21 #Python
Python实现删除文件但保留指定文件
Jun 21 #Python
Python ValueError: invalid literal for int() with base 10 实用解决方法
Jun 21 #Python
让Python代码更快运行的5种方法
Jun 21 #Python
Python文件读取的3种方法及路径转义
Jun 21 #Python
You might like
php获取网页请求状态程序示例
2014/06/17 PHP
PHP中使用sleep函数实现定时任务实例分享
2014/08/21 PHP
php实现统计网站在线人数的方法
2015/05/12 PHP
PHP模拟asp.net的StringBuilder类实现方法
2015/08/08 PHP
PHP网站建设的流程与步骤分享
2015/09/25 PHP
Zend Framework实现具有基本功能的留言本(附demo源码下载)
2016/03/22 PHP
setInterval,setTimeout与jquery混用的问题
2013/04/08 Javascript
node.js中的url.resolve方法使用说明
2014/12/10 Javascript
JQuery中层次选择器用法实例详解
2015/05/18 Javascript
jquery实现简单实用的弹出层效果代码
2015/10/15 Javascript
jQuery版本升级踩坑大全
2016/01/12 Javascript
javascript 面向对象function详解及实例代码
2017/02/28 Javascript
AngularJS自定义指令实现面包屑功能完整实例
2017/05/17 Javascript
Javascript 编码约定(编码规范)
2018/03/11 Javascript
发布订阅模式在vue中的实际运用实例详解
2019/06/09 Javascript
vue.js中ref和$refs的使用及示例讲解
2019/08/14 Javascript
解决vue中axios设置超时(超过5分钟)没反应的问题
2020/09/04 Javascript
[02:04]2016国际邀请赛中国区预选赛VG.R晋级之路
2016/07/01 DOTA
python 显示数组全部元素的方法
2018/04/19 Python
pyqt5使用按钮进行界面的跳转方法
2019/06/19 Python
详解Django 时间与时区设置问题
2019/07/23 Python
Python实现剪刀石头布小游戏(与电脑对战)
2019/12/31 Python
如何通过python实现全排列
2020/02/11 Python
Python图片处理模块PIL操作方法(pillow)
2020/04/07 Python
python基本算法之实现归并排序(Merge sort)
2020/09/01 Python
ProBikeKit英国:在线公路自行车之家
2017/02/10 全球购物
沙特阿拉伯家用电器和电子产品购物网站:Sheta and Saif
2020/04/03 全球购物
通信专业个人自我鉴定
2013/10/21 职场文书
项目建议书范文
2014/05/12 职场文书
九一八事变纪念日演讲稿
2014/09/14 职场文书
公司党的群众路线教育实践活动领导班子对照检查材料
2014/09/25 职场文书
镇党委书记群众路线整改措施思想汇报
2014/10/13 职场文书
招商引资工作汇报材料
2014/10/28 职场文书
诚信承诺书
2015/01/19 职场文书
授权协议书范本(3篇)
2019/10/15 职场文书
HTML基本元素标签介绍
2022/02/28 HTML / CSS