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连接SQLServer2000的方法详解
Apr 19 Python
python批量下载网站马拉松照片的完整步骤
Dec 05 Python
Python实现的文轩网爬虫完整示例
May 16 Python
python绘制多个子图的实例
Jul 07 Python
python高斯分布概率密度函数的使用详解
Jul 10 Python
浅谈Python中(&amp;,|)和(and,or)之间的区别
Aug 07 Python
基于Pycharm加载多个项目过程图解
Jan 19 Python
Python读取配置文件(config.ini)以及写入配置文件
Apr 08 Python
Python json读写方式和字典相互转化
Apr 18 Python
使用Keras实现Tensor的相乘和相加代码
Jun 18 Python
教你怎么用Python实现多路径迷宫
Apr 29 Python
python manim实现排序算法动画示例
Aug 14 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
打造计数器DIY三步曲(中)
2006/10/09 PHP
优化使用mysql存储session的php代码
2008/01/10 PHP
验证坐标在某坐标区域内php代码
2016/10/08 PHP
thinkphp框架表单数组实现图片批量上传功能示例
2020/04/04 PHP
php中数组最简单的使用方法
2020/12/27 PHP
收藏一些不常用,但是有用的代码
2007/03/12 Javascript
IE6下opacity与JQuery的奇妙结合
2013/03/01 Javascript
在表单提交前进行验证的几种方式整理
2013/07/31 Javascript
jquery实现带单选按钮的表格行选中时高亮显示
2013/08/01 Javascript
js实现拖拽效果
2015/02/12 Javascript
JS更改select内option属性的方法
2015/10/14 Javascript
关于在Servelet中如何获取当前时间的操作方法
2016/06/28 Javascript
通过BootStrap-select插件 js jQuery控制select属性变化
2017/01/03 Javascript
jquery实现多次上传同一张图片
2017/01/09 Javascript
js禁止浏览器的回退事件
2017/04/20 Javascript
Angular中$state.go页面跳转并传递参数的方法
2017/05/09 Javascript
JS实现websocket长轮询实时消息提示的效果
2017/10/10 Javascript
Javascript中JSON数据分组优化实践及JS操作JSON总结
2017/12/22 Javascript
vue监听键盘事件的快捷方法【推荐】
2018/07/11 Javascript
Vue中常用rules校验规则(实例代码)
2019/11/14 Javascript
JavaScript的console命令使用实例
2019/12/03 Javascript
python根据经纬度计算距离示例
2014/02/16 Python
python实现图片批量剪切示例
2014/03/25 Python
详细讲解用Python发送SMTP邮件的教程
2015/04/29 Python
Python文本相似性计算之编辑距离详解
2016/11/28 Python
python中安装模块包版本冲突问题的解决
2017/05/02 Python
Python中pandas dataframe删除一行或一列:drop函数详解
2018/07/03 Python
Python安装Flask环境及简单应用示例
2019/05/03 Python
2020新版本pycharm+anaconda+opencv+pyqt环境配置学习笔记,亲测可用
2020/03/24 Python
浅谈python多线程和多线程变量共享问题介绍
2020/04/17 Python
Python的scikit-image模块实例讲解
2020/12/30 Python
企业管理毕业生求职信
2014/03/11 职场文书
春节晚会主持词
2014/03/24 职场文书
田径运动会开幕式及主持词
2014/03/28 职场文书
付款证明格式范文
2015/06/19 职场文书
2019年共青团工作条例最新版
2019/11/12 职场文书