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中实现对list做减法操作介绍
Jan 09 Python
分享一个可以生成各种进制格式IP的小工具实例代码
Jul 28 Python
Python2与python3中 for 循环语句基础与实例分析
Nov 20 Python
Python图形绘制操作之正弦曲线实现方法分析
Dec 25 Python
python学习基础之循环import及import过程
Apr 22 Python
Python中的CSV文件使用&quot;with&quot;语句的方式详解
Oct 16 Python
python分块读取大数据,避免内存不足的方法
Dec 10 Python
keras使用Sequence类调用大规模数据集进行训练的实现
Jun 22 Python
Python中logging日志记录到文件及自动分割的操作代码
Aug 05 Python
python爬虫工具例举说明
Nov 30 Python
matplotlib交互式数据光标实现(mplcursors)
Jan 13 Python
Python 转移文件至云对象存储的方法
Feb 07 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
漂亮但不安全的CTB
2006/10/09 PHP
FirePHP 推荐一款PHP调试工具
2011/04/23 PHP
destoon数据库表说明汇总
2014/07/15 PHP
php实现购物车产品删除功能(2)
2020/07/23 PHP
善用事件代理,警惕闭包的性能陷阱。
2011/01/20 Javascript
js原生态函数中使用jQuery中的 $(this)无效的解决方法
2011/05/25 Javascript
Underscore.js 的模板功能介绍与应用
2012/12/24 Javascript
JS和jquery获取各种屏幕的宽度和高度的代码
2013/08/02 Javascript
超精准的javascript验证身份证号的具体实现方法
2015/11/18 Javascript
用js读写cookie的简单方法(推荐)
2016/08/08 Javascript
AngularJs Injecting Services Into Controllers详解
2016/09/02 Javascript
脚本div实现拖放功能(两种)
2017/02/13 Javascript
JavaScript运动框架 解决速度正负取整问题(一)
2017/05/17 Javascript
原生JS实现 MUI导航栏透明渐变效果
2017/11/07 Javascript
jQuery图片查看插件Magnify开发详解
2017/12/25 jQuery
React Native中NavigatorIOS组件的简单使用详解
2018/01/27 Javascript
解决linux下node.js全局模块找不到的问题
2018/05/15 Javascript
vue-cli项目中使用公用的提示弹层tips或加载loading组件实例详解
2018/05/28 Javascript
微信小程序实现Swiper轮播图效果
2019/11/22 Javascript
python通过apply使用元祖和列表调用函数实例
2015/05/26 Python
Python中函数参数设置及使用的学习笔记
2016/05/03 Python
利用Python爬取微博数据生成词云图片实例代码
2017/08/31 Python
Python列表推导式与生成器用法分析
2018/08/02 Python
pycharm不以pytest方式运行,想要切换回普通模式运行的操作
2020/09/01 Python
Python猫眼电影最近上映的电影票房信息
2020/09/18 Python
Theflamel意大利:女士奢华服装、鞋子和配件
2020/01/11 全球购物
越南母婴用品购物网站:Kids Plaza
2020/04/09 全球购物
main 函数执行以前,还会执行什么代码
2013/04/17 面试题
什么是触发器(trigger)? 触发器有什么作用?
2013/09/18 面试题
行政部主管岗位职责
2013/12/28 职场文书
六查六看自查材料
2014/02/17 职场文书
意外伤害赔偿协议书
2014/09/16 职场文书
2014年大学生党员评议表自我评价
2014/09/20 职场文书
小学科学课教学反思
2016/02/23 职场文书
tomcat的catalina.out日志按自定义时间格式进行分割的操作方法
2022/04/02 Servers
古见同学有交流障碍症 第二季宣传CM公开播出
2022/04/11 日漫