Python如何安装第三方模块


Posted in Python onMay 28, 2020

Python中有哪几种方法安装第三方模块,安装Python第三方模块的方法有很多,这里介绍三种方法安装第三方模块。

【方法一】: 通过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></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安装第三方模块的方法内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Python 相关文章推荐
python使用urllib2模块获取gravatar头像实例
Dec 18 Python
Python实现list反转实例汇总
Nov 11 Python
Python中二维列表如何获取子区域元素的组成
Jan 19 Python
numpy.random.seed()的使用实例解析
Feb 03 Python
django静态文件加载的方法
May 20 Python
python 利用栈和队列模拟递归的过程
May 29 Python
在Python函数中输入任意数量参数的实例
Jul 16 Python
Python Web框架之Django框架Form组件用法详解
Aug 16 Python
Python模块 _winreg操作注册表
Feb 05 Python
python实现图像拼接
Mar 05 Python
python3 xpath和requests应用详解
Mar 06 Python
细说NumPy数组的四种乘法的使用
Dec 18 Python
python使用多线程+socket实现端口扫描
May 28 #Python
Python如何实现定时器功能
May 28 #Python
python实点云分割k-means(sklearn)详解
May 28 #Python
Python脚本实现监听服务器的思路代码详解
May 28 #Python
python中Ansible模块的Playbook的具体使用
May 28 #Python
python中如何进行连乘计算
May 28 #Python
python线程池如何使用
May 28 #Python
You might like
php函数array_merge用法一例(合并同类数组)
2013/02/03 PHP
php setcookie函数的参数说明及其用法
2014/04/20 PHP
php实现的统计字数函数定义与使用示例
2017/07/26 PHP
如何通过View::first使用Laravel Blade的动态模板详解
2017/09/21 PHP
php微信开发之关键词回复功能
2018/06/13 PHP
JS控制表格隔行变色
2006/06/26 Javascript
jQuery prev ~ siblings选择器使用介绍
2013/08/09 Javascript
对Web开发中前端框架与前端类库的一些思考
2015/03/27 Javascript
jQuery 遍历函数详解
2015/07/05 Javascript
Javascript中字符串和数字的操作方法整理
2017/01/22 Javascript
浅谈Vuejs Prop基本用法
2017/08/17 Javascript
实现高性能javascript的注意事项
2019/05/27 Javascript
jquery操作select常见方法大全【7种情况】
2019/05/28 jQuery
微信小程序页面间跳转传参方式总结
2019/06/13 Javascript
原生js实现抽奖小游戏
2019/06/27 Javascript
js get和post请求实现代码解析
2020/02/06 Javascript
python将图片文件转换成base64编码的方法
2015/03/14 Python
python实现DES加密解密方法实例详解
2015/06/30 Python
Python中使用asyncio 封装文件读写
2016/09/11 Python
Python的爬虫框架scrapy用21行代码写一个爬虫
2017/04/24 Python
浅谈Python基础之I/O模型
2017/05/11 Python
Python3使用SMTP发送带附件邮件
2020/06/16 Python
对python3 Serial 串口助手的接收读取数据方法详解
2019/06/12 Python
python flask搭建web应用教程
2019/11/19 Python
Python调用钉钉自定义机器人的实现
2020/01/03 Python
浅谈Tensorflow 动态双向RNN的输出问题
2020/01/20 Python
selenium设置浏览器为headless无头模式(Chrome和Firefox)
2021/01/08 Python
Python3使用Selenium获取session和token方法详解
2021/02/16 Python
CSS3 rgb and rgba(透明色)的使用详解
2020/09/25 HTML / CSS
J2EE是技术还是平台还是框架
2016/08/14 面试题
高级护理专业毕业生推荐信
2013/12/25 职场文书
财务部副经理岗位职责
2014/03/14 职场文书
2015年药店店长工作总结
2015/04/29 职场文书
Z-Order加速Hudi大规模数据集方案分析
2022/03/31 Servers
frg-100简单操作(设置)说明
2022/04/05 无线电
postgreSQL数据库基础知识介绍
2022/04/12 PostgreSQL