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的迭代器和生成器使用实例
Jan 14 Python
用Python创建声明性迷你语言的教程
Apr 13 Python
Python使用pylab库实现绘制直方图功能示例
Jun 01 Python
Python读取excel中的图片完美解决方法
Jul 27 Python
win7+Python3.5下scrapy的安装方法
Jul 31 Python
Python求两个圆的交点坐标或三个圆的交点坐标方法
Nov 07 Python
Python实现定时执行任务的三种方式简单示例
Mar 30 Python
Python转换时间的图文方法
Jul 01 Python
nginx+uwsgi+django环境搭建的方法步骤
Nov 25 Python
使用pyqt5 tablewidget 单元格设置正则表达式
Dec 13 Python
基于Python的Jenkins的二次开发操作
May 12 Python
python 调整图片亮度的示例
Dec 03 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 include和require的区别深入解析
2013/06/17 PHP
CodeIgniter启用缓存和清除缓存的方法
2014/06/12 PHP
如何使用php实现评委评分器
2015/07/31 PHP
解决laravel 5.1报错:No supported encrypter found的办法
2017/06/07 PHP
在IE模态窗口中自由查看HTML源码的方法
2007/03/08 Javascript
json对象转字符串如何实现
2012/12/02 Javascript
中文输入法不触发onkeyup事件的解决办法
2014/07/09 Javascript
抛弃Nginx使用nodejs做反向代理服务器
2014/07/17 NodeJs
将数字转换成大写的人民币表达式的js函数
2014/09/21 Javascript
JS的数组迭代方法
2015/02/05 Javascript
javascript拖拽效果延伸学习
2016/04/04 Javascript
jQuery获取file控件中图片的宽高与大小
2016/08/04 Javascript
CentOS 安装NodeJS V8.0.0的方法
2017/06/15 NodeJs
Async Validator 异步验证使用说明
2017/07/03 Javascript
jQuery实现的导航条点击后高亮显示功能示例
2019/03/04 jQuery
js定时器出现第一次延迟的原因及解决方法
2021/01/04 Javascript
[01:45]绝对公平!DOTA2队长征召模式详解
2014/04/25 DOTA
在Python的gevent框架下执行异步的Solr查询的教程
2015/04/16 Python
python bottle框架支持jquery ajax的RESTful风格的PUT和DELETE方法
2017/05/24 Python
浅谈python日志的配置文件路径问题
2018/04/28 Python
Python用csv写入文件_消除空余行的方法
2018/07/06 Python
Python创建或生成列表的操作方法
2019/06/19 Python
关于PyTorch源码解读之torchvision.models
2019/08/17 Python
详解pyinstaller selenium python3 chrome打包问题
2019/10/18 Python
经典c++面试题四
2015/05/14 面试题
应届生自荐信范文
2014/02/21 职场文书
计算机应届毕业生自荐信范文
2014/02/23 职场文书
企业后勤岗位职责
2014/02/28 职场文书
新品发布会策划方案
2014/06/08 职场文书
超市客服工作职责
2014/06/11 职场文书
材料员岗位职责
2015/02/10 职场文书
售后前台接待岗位职责
2015/04/03 职场文书
文员岗位职责范本
2015/04/16 职场文书
分享提高 Python 代码的可读性的技巧
2022/03/03 Python
python和Appium的移动端多设备自动化测试框架
2022/04/26 Python
Shell中的单中括号和双中括号的用法详解
2022/12/24 Servers