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代码做configure文件
Jul 20 Python
python通过socket查询whois的方法
Jul 18 Python
一个基于flask的web应用诞生 bootstrap框架美化(3)
Apr 11 Python
Python模拟鼠标点击实现方法(将通过实例自动化模拟在360浏览器中自动搜索python)
Aug 23 Python
python读取excel表格生成erlang数据
Aug 26 Python
python机器学习之决策树分类详解
Dec 20 Python
python爬取拉勾网职位数据的方法
Jan 24 Python
python获取文件路径、文件名、后缀名的实例
Apr 23 Python
python使用BeautifulSoup与正则表达式爬取时光网不同地区top100电影并对比
Apr 15 Python
基于python的itchat库实现微信聊天机器人(推荐)
Oct 29 Python
详解python第三方库的安装、PyInstaller库、random库
Mar 03 Python
pytorch加载预训练模型与自己模型不匹配的解决方案
May 13 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
smtp邮件发送一例
2006/10/09 PHP
PHP 获取客户端真实IP地址多种方法小结
2010/05/15 PHP
php最简单的删除目录与文件实现方法
2014/11/28 PHP
PHP实现简易blog的制作
2016/10/24 PHP
Yii2实现增删改查后留在当前页的方法详解
2017/01/13 PHP
PHP重载基础知识回顾
2020/09/10 PHP
JS input文本框禁用右键和复制粘贴功能的代码
2010/04/15 Javascript
Javascript call和apply区别及使用方法
2013/11/14 Javascript
javascript与有限状态机详解
2014/05/08 Javascript
jQuery给动态添加的元素绑定事件的方法
2015/03/09 Javascript
纯JS实现旋转图片3D展示效果
2015/04/12 Javascript
详解vuelidate 对于vueJs2.0的验证解决方案
2017/03/09 Javascript
vue2.0实战之使用vue-cli搭建项目(2)
2017/03/27 Javascript
微信小程序 下拉菜单简单实例
2017/04/13 Javascript
jquery replace方法去空格
2017/05/08 jQuery
VUE 全局变量的几种实现方式
2018/08/22 Javascript
在Chrome DevTools中调试JavaScript的实现
2020/04/07 Javascript
[00:03]DOTA2新版本PA至宝展示
2014/11/19 DOTA
[47:04]LGD vs infamous Supermajor小组赛D组 BO3 第二场 6.3
2018/06/04 DOTA
Python操作串口的方法
2015/06/17 Python
Python Flask-web表单使用详解
2017/11/18 Python
Python paramiko模块的使用示例
2018/04/11 Python
对python中的for循环和range内置函数详解
2018/04/17 Python
python切片及sys.argv[]用法详解
2018/05/25 Python
Python实现的多进程拷贝文件并显示百分比功能示例
2019/04/09 Python
使用pytorch完成kaggle猫狗图像识别方式
2020/01/10 Python
python中68个内置函数的总结与介绍
2020/02/24 Python
Html5跳转到APP指定页面的实现
2020/01/14 HTML / CSS
孕妇内衣和胸罩:Cake Maternity
2018/07/16 全球购物
生物技术专业毕业生求职信范文
2013/12/14 职场文书
中学生爱国演讲稿
2013/12/31 职场文书
生物学学生自我评价
2014/01/17 职场文书
2014年银行信贷员工作总结
2014/12/08 职场文书
2015年超市工作总结
2015/04/09 职场文书
开学第一天的感想
2015/08/10 职场文书
十大最强格斗系宝可梦,超梦X仅排第十,第二最重格斗礼仪
2022/03/18 日漫