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中requests爬去网页内容出现乱码问题解决方法介绍
Oct 25 Python
浅谈Python NLP入门教程
Dec 25 Python
tensorflow 中对数组元素的操作方法
Jul 27 Python
python中退出多层循环的方法
Nov 27 Python
python plotly绘制直方图实例详解
Jul 22 Python
如何在Cloud Studio上执行Python代码?
Aug 09 Python
python编写计算器功能
Oct 25 Python
Python列表操作方法详解
Feb 09 Python
python虚拟环境模块venv使用及示例
Mar 04 Python
python selenium 获取接口数据的实现
Dec 07 Python
Python 用__new__方法实现单例的操作
Dec 11 Python
Python自动化测试PO模型封装过程详解
Jun 22 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
网页游戏开发入门教程三(简单程序应用)
2009/11/02 PHP
ThinkPHP中Common/common.php文件常用函数功能分析
2016/05/20 PHP
PHP检查网站是否宕机的方法示例
2017/07/24 PHP
jQuery maxlength文本字数限制插件
2010/04/16 Javascript
使用js简单实现了tree树菜单
2013/11/20 Javascript
node.js使用nodemailer发送邮件实例
2014/03/10 Javascript
jquery实现未经美化的简洁TAB菜单效果
2015/08/28 Javascript
javascript和jQuery中的AJAX技术详解【包含AJAX各种跨域技术】
2016/12/15 Javascript
jQuery中的on与bind绑定事件区别实例详解
2017/02/28 Javascript
jQuery布局组件EasyUI Layout使用方法详解
2017/02/28 Javascript
JS三目运算(三元运算)方法详解
2017/03/01 Javascript
ES6入门教程之Class和Module详解
2017/05/17 Javascript
vue2里面ref的具体使用方法
2017/10/27 Javascript
微信小程序App生命周期详解
2018/01/31 Javascript
JavaScript异步加载问题总结
2018/02/17 Javascript
vue+springmvc导出excel数据的实现代码
2018/06/27 Javascript
解决vue-router 二级导航默认选中某一选项的问题
2019/11/01 Javascript
Vue使用screenfull实现全屏效果
2020/09/17 Javascript
pycharm 使用心得(二)设置字体大小
2014/06/05 Python
python开发之IDEL(Python GUI)的使用方法图文详解
2015/11/12 Python
Python 3.x读写csv文件中数字的方法示例
2017/08/29 Python
Python smtplib实现发送邮件功能
2018/05/22 Python
python3模块smtplib实现发送邮件功能
2018/05/22 Python
基于Python实现迪杰斯特拉和弗洛伊德算法
2020/05/27 Python
超简单使用Python换脸实例
2019/03/27 Python
Python异常模块traceback用法实例分析
2019/10/22 Python
HTML5 WebSocket实现点对点聊天的示例代码
2018/01/31 HTML / CSS
加拿大领先的优质厨具产品在线购物网站:Golda’s Kitchen
2017/11/17 全球购物
传统软件工程与面向对象的软件工程有什么区别
2012/05/31 面试题
家长给幼儿园的表扬信
2014/01/09 职场文书
单位接收函格式
2015/01/30 职场文书
2016春季幼儿园小班开学寄语
2015/12/03 职场文书
毕业欢送晚会主持词
2019/06/25 职场文书
Spring Data JPA使用JPQL与原生SQL进行查询的操作
2021/06/15 Java/Android
springboot拦截器无法注入redisTemplate的解决方法
2021/06/27 Java/Android
Win11怎么跳过联网验机 ?Win11跳过联网验机激活教程
2022/04/05 数码科技