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 域名分析工具实现代码
Jul 15 Python
跟老齐学Python之网站的结构
Oct 24 Python
Python中处理字符串之islower()方法的使用简介
May 19 Python
python模块之time模块(实例讲解)
Sep 13 Python
Python数据预处理之数据规范化(归一化)示例
Jan 08 Python
Python如何使用字符打印照片
Jan 03 Python
python实现的分层随机抽样案例
Feb 25 Python
python opencv 图像边框(填充)添加及图像混合的实现方法(末尾实现类似幻灯片渐变的效果)
Mar 09 Python
python初步实现word2vec操作
Jun 09 Python
python识别验证码的思路及解决方案
Sep 13 Python
python 服务器运行代码报错ModuleNotFoundError的解决办法
Sep 16 Python
python Matplotlib基础--如何添加文本和标注
Jan 26 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
2019年漫画销量排行榜:鬼灭登顶 海贼单卷制霸 尾田盛赞鬼灭
2020/03/08 日漫
PHP入门速成(2)
2006/10/09 PHP
谈谈关于php的优点与缺点
2013/04/11 PHP
PHP7.0安装笔记整理
2015/08/28 PHP
js function使用心得
2010/05/10 Javascript
js获取url参数代码实例分享(JS操作URL)
2013/12/13 Javascript
页面实时更新时间的JS实例代码
2013/12/18 Javascript
Jquery原生态实现表格header头随滚动条滚动而滚动
2014/03/18 Javascript
JS实现鼠标经过好友列表中的好友头像时显示资料卡的效果
2014/07/02 Javascript
JavaScript常用函数工具集:lao-utils
2016/03/01 Javascript
JS获取input[file]的值并显示在页面的实现方法
2018/03/09 Javascript
浅谈ElementUI中switch回调函数change的参数问题
2018/08/24 Javascript
详解React之key的使用和实践
2018/09/29 Javascript
ES6 更易于继承的类语法的使用
2019/02/11 Javascript
详解关于element级联选择器数据回显问题
2019/02/20 Javascript
uniapp,微信小程序中使用 MQTT的问题
2020/07/11 Javascript
Python for Informatics 第11章之正则表达式(四)
2016/04/21 Python
Python设计足球联赛赛程表程序的思路与简单实现示例
2016/06/28 Python
Django卸载之后重新安装的方法
2017/03/15 Python
python多进程实现文件下载传输功能
2018/07/28 Python
Python编程flask使用页面模版的方法
2018/12/28 Python
python3使用QQ邮箱发送邮件
2020/05/20 Python
Django自定义模板过滤器和标签的实现方法
2019/08/21 Python
Django 实现xadmin后台菜单改为中文
2019/11/15 Python
python随机生成大小写字母数字混合密码(仅20行代码)
2020/02/01 Python
python新式类和经典类的区别实例分析
2020/03/23 Python
Django 拼接两个queryset 或是两个不可以相加的对象实例
2020/03/28 Python
Python实现一个论文下载器的过程
2021/01/18 Python
优秀员工表扬信
2014/01/17 职场文书
优秀护士获奖感言
2014/02/20 职场文书
授权委托书怎么写
2014/04/03 职场文书
党员教师批评与自我批评发言稿
2014/10/15 职场文书
从事会计工作年限证明
2015/06/23 职场文书
祝寿主持词
2015/07/02 职场文书
python四个坐标点对图片区域最小外接矩形进行裁剪
2021/06/04 Python
攻略丨滑雪究竟该选哪款对讲机?
2022/02/18 无线电