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创建声明性迷你语言的教程
Apr 13 Python
python判断字符串编码的简单实现方法(使用chardet)
Jul 01 Python
Python中字典的setdefault()方法教程
Feb 07 Python
Python实现的选择排序算法示例
Nov 29 Python
利用python解决mysql视图导入导出依赖的问题
Dec 17 Python
Python爬虫小技巧之伪造随机的User-Agent
Sep 13 Python
Python Pywavelet 小波阈值实例
Jan 09 Python
python aiohttp的使用详解
Jun 20 Python
python+Django实现防止SQL注入的办法
Oct 31 Python
Python itertools.product方法代码实例
Mar 27 Python
Anaconda配置pytorch-gpu虚拟环境的图文教程
Apr 16 Python
python实现ping命令小程序
Dec 28 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
在WordPress中使用wp-cron插件来设置定时任务
2015/12/10 PHP
php实现的生成迷宫与迷宫寻址算法完整实例
2017/11/06 PHP
基于php数组中的索引数组和关联数组详解
2018/03/12 PHP
浅谈Laravel模板实体转义带来的坑
2019/10/22 PHP
PHP框架实现WebSocket在线聊天通讯系统
2019/11/21 PHP
记Laravel调用Gin接口调用formData上传文件的实现方法
2019/12/12 PHP
jQuery第三课 修改元素属性及内容的代码
2010/03/14 Javascript
javascript中自定义对象的属性方法分享
2013/07/12 Javascript
javascript浏览器兼容教程之事件处理
2014/06/09 Javascript
手机号码,密码正则验证
2014/09/04 Javascript
微信小程序 地图(map)实例详解
2016/11/16 Javascript
ajax异步请求详解
2017/01/06 Javascript
使用react-router4.0实现重定向和404功能的方法
2017/08/28 Javascript
layer实现关闭弹出层刷新父界面功能详解
2017/11/15 Javascript
详解JavaScript修改注册表的方法
2020/01/05 Javascript
[16:56]heroes英雄教学 司夜刺客
2014/09/18 DOTA
wxpython中利用线程防止假死的实现方法
2014/08/11 Python
Python实现从url中提取域名的几种方法
2014/09/26 Python
centos6.4下python3.6.1安装教程
2017/07/21 Python
Python 闭包的使用方法
2017/09/07 Python
python linecache 处理固定格式文本数据的方法
2019/01/08 Python
python中导入 train_test_split提示错误的解决
2020/06/19 Python
CSS3实现瀑布流布局与无限加载图片相册的实例代码
2016/12/22 HTML / CSS
使用javascript和HTML5 Canvas画的四渐变色播放按钮效果
2014/04/10 HTML / CSS
HomeAway的巴西品牌:Alugue Temporada
2018/04/10 全球购物
static函数与普通函数有什么区别
2015/12/25 面试题
大四毕业生学习总结的自我评价
2013/10/31 职场文书
《会变的花树叶》教学反思
2014/02/10 职场文书
士力架广告词
2014/03/20 职场文书
乡镇领导班子批评与自我批评材料
2014/09/23 职场文书
发展党员工作情况汇报
2014/10/28 职场文书
2014五年级班主任工作总结
2014/12/05 职场文书
毕业生就业推荐表导师评语
2014/12/31 职场文书
乡镇法制宣传日活动总结
2015/05/05 职场文书
品德与社会教学反思
2016/02/24 职场文书
详解python中[-1]、[:-1]、[::-1]、[n::-1]使用方法
2021/04/25 Python