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中使用装饰器时需要注意的一些问题
May 11 Python
使用Python简单的实现树莓派的WEB控制
Feb 18 Python
使用Python写一个贪吃蛇游戏实例代码
Aug 21 Python
Python利用turtle库绘制彩虹代码示例
Dec 20 Python
Python读取MRI并显示为灰度图像实例代码
Jan 03 Python
Python数据可视化库seaborn的使用总结
Jan 15 Python
python多继承(钻石继承)问题和解决方法简单示例
Oct 21 Python
基于python实现坦克大战游戏
Oct 27 Python
Python中读取文件名中的数字的实例详解
Dec 25 Python
python之PySide2安装使用及QT Designer UI设计案例教程
Jul 26 Python
python脚本框架webpy模板控制结构
Nov 20 Python
用Python可视化新冠疫情数据
Jan 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获取通过http协议post提交过来xml数据及解析xml
2012/12/16 PHP
php通过exif_read_data函数获取图片的exif信息
2015/05/21 PHP
Cygwin中安装PHP方法步骤
2015/07/04 PHP
PHP实现的pdo连接数据库并插入数据功能简单示例
2019/03/30 PHP
php使用event扩展的io复用测试的示例
2020/10/20 PHP
js中document.getElementByid、document.all和document.layers区分介绍
2011/12/08 Javascript
uploadify 3.0 详细使用说明
2012/06/18 Javascript
JavaScript高级程序设计(第3版)学习笔记13 ECMAScript5新特性
2012/10/11 Javascript
异步动态加载JS并运行(示例代码)
2013/12/13 Javascript
js调试工具Console命令详解
2014/10/21 Javascript
JavaScript 学习笔记之变量及其作用域
2015/01/14 Javascript
ionic实现带字的toggle滑动组件
2016/08/27 Javascript
实例分析nodejs模块xml2js解析xml过程中遇到的坑
2017/03/18 NodeJs
Angular2使用Augury来调试Angular2程序
2017/05/21 Javascript
基于JavaScript实现幸运抽奖页面
2020/07/05 Javascript
JavaScript设计模式之模板方法模式原理与用法示例
2018/08/07 Javascript
layui实现table加载的示例代码
2018/08/14 Javascript
vue webpack开发访问后台接口全局配置的方法
2018/09/18 Javascript
vue实现图片按比例缩放问题操作
2020/08/11 Javascript
探索浏览器页面关闭window.close()的使用详解
2020/08/21 Javascript
对vue生命周期的深入理解
2020/12/03 Vue.js
Python数组条件过滤filter函数使用示例
2014/07/22 Python
Python中的map()函数和reduce()函数的用法
2015/04/27 Python
python得到单词模式的示例
2018/10/15 Python
python获取交互式ssh shell的方法
2019/02/14 Python
解决django 向mysql中写入中文字符出错的问题
2020/05/18 Python
pytorch随机采样操作SubsetRandomSampler()
2020/07/07 Python
如何将json数据转换为python数据
2020/09/04 Python
常用的四种CSS透明属性介绍
2014/04/12 HTML / CSS
应用服务器有那些
2012/01/19 面试题
校园餐饮创业计划书
2014/01/10 职场文书
水利水电专业自荐信
2014/07/08 职场文书
管理工程专业求职信
2014/08/10 职场文书
学前教育专业求职信
2014/09/02 职场文书
小学语文教师研修感悟
2015/11/18 职场文书
深入解读Java三大集合之map list set的用法
2021/11/11 Java/Android