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中os操作文件及文件路径实例汇总
Jan 15 Python
Python随机生成彩票号码的方法
Mar 05 Python
python打开文件并获取文件相关属性的方法
Apr 23 Python
IntelliJ IDEA安装运行python插件方法
Dec 10 Python
python 魔法函数实例及解析
Sep 25 Python
Python : turtle色彩控制实例详解
Jan 19 Python
selenium+python配置chrome浏览器的选项的实现
Mar 18 Python
Python scrapy爬取小说代码案例详解
Jul 09 Python
Python中的None与 NULL(即空字符)的区别详解
Sep 24 Python
python 从list中随机取值的方法
Nov 16 Python
详解python网络进程
Jun 15 Python
Python 详解通过Scrapy框架实现爬取百度新冠疫情数据流程
Nov 11 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实现百度网盘图片直链的代码分享
2012/11/01 PHP
PHP中使用CURL模拟登录并获取数据实例
2014/07/01 PHP
php获取根域名方法汇总
2014/10/28 PHP
PHP二维数组排序简单实现方法
2016/02/14 PHP
php 无限级分类 获取顶级分类ID
2016/03/13 PHP
php简单实现多语言切换的方法
2016/05/09 PHP
Mac下快速搭建PHP开发环境步骤详解
2019/05/05 PHP
用YUI做了个标签浏览效果
2007/02/20 Javascript
js获取IP和PcName(IE)在vs中可用
2013/08/02 Javascript
jquery用offset()方法获得元素的xy坐标
2014/09/06 Javascript
JS+CSS实现感应鼠标渐变显示DIV层的方法
2015/02/20 Javascript
JavaScript随机打乱数组顺序之随机洗牌算法
2016/08/02 Javascript
原生js实现放大镜
2017/02/20 Javascript
vue分类筛选filter方法简单实例
2017/03/30 Javascript
mpvue将vue项目转换为小程序
2018/09/30 Javascript
Node.js使用MongoDB的ObjectId作为查询条件的方法
2019/09/10 Javascript
小程序实现长按保存图片的方法
2019/12/31 Javascript
vue.js实现双击放大预览功能
2020/06/23 Javascript
Python实现多线程抓取妹子图
2015/08/08 Python
详解Python3中yield生成器的用法
2015/08/20 Python
python决策树之CART分类回归树详解
2017/12/20 Python
python 列表,数组,矩阵两两转换tolist()的实例
2018/04/04 Python
如何用Python合并lmdb文件
2018/07/02 Python
python基于gevent实现并发下载器代码实例
2019/11/01 Python
解决django-xadmin列表页filter关联对象搜索问题
2019/11/15 Python
通过实例解析Python调用json模块
2019/12/11 Python
python使用正则表达式(Regular Expression)方法超详细
2019/12/30 Python
Python 分布式缓存之Reids数据类型操作详解
2020/06/24 Python
python操作微信自动发消息的实现(微信聊天机器人)
2020/07/14 Python
Django:使用filter的pk进行多值查询操作
2020/07/15 Python
博士生导师推荐信
2014/07/08 职场文书
五四青年节的活动方案
2014/08/20 职场文书
见习报告的格式
2014/10/31 职场文书
2014年平安建设工作总结
2014/11/19 职场文书
小学生五一劳动节演讲稿
2015/03/18 职场文书
2019商业计划书格式、范文
2019/04/24 职场文书