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爬虫
Dec 25 Python
使用Python压缩和解压缩zip文件的教程
May 06 Python
Python中Numpy包的安装与使用方法简明教程
Jul 03 Python
Python 新建文件夹与复制文件夹内所有内容的方法
Oct 27 Python
Python实现的IP端口扫描工具类示例
Feb 15 Python
python操作文件的参数整理
Jun 11 Python
解决webdriver.Chrome()报错:Message:'chromedriver' executable needs to be in Path
Jun 12 Python
Python企业编码生成系统总体系统设计概述
Jul 26 Python
浅谈Pycharm的项目文件名是红色的原因及解决方式
Jun 01 Python
linux centos 7.x 安装 python3.x 替换 python2.x的过程解析
Dec 14 Python
python 爬取哔哩哔哩up主信息和投稿视频
Jun 07 Python
尝试使用Python爬取城市租房信息
Apr 12 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
JAVA/JSP学习系列之七
2006/10/09 PHP
php socket方式提交的post详解
2008/07/19 PHP
PHP常用代码大全(新手入门必备)
2010/06/29 PHP
php 下载保存文件保存到本地的两种实现方法
2013/08/12 PHP
jquery 问答知识整理
2010/02/11 Javascript
getAsDataURL在Firefox7.0下无法预览本地图片的解决方法
2013/11/15 Javascript
快速解决jQuery与其他库冲突的方法介绍
2014/01/02 Javascript
jquery实现可点击伸缩与展开的菜单效果代码
2015/08/31 Javascript
jquery简单实现带渐显效果的选项卡菜单代码
2015/09/01 Javascript
不能不知道的10个angularjs英文学习网站
2016/03/23 Javascript
JavaScript事件处理的方式(三种)
2016/04/26 Javascript
javascript小数精度丢失的完美解决方法
2016/05/31 Javascript
Spring Boot+AngularJS+BootStrap实现进度条示例代码
2017/03/02 Javascript
自定义事件解决重复请求BUG的问题
2017/07/11 Javascript
一个Js文件函数中调用另一个Js文件函数的方法演示
2017/08/14 Javascript
nodejs实现的简单web服务器功能示例
2018/03/15 NodeJs
angular6根据environments配置文件更改开发所需要的环境的方法
2019/03/06 Javascript
Python实现遍历数据库并获取key的值
2015/05/17 Python
python实现ping的方法
2015/07/06 Python
浅谈Python数据类型判断及列表脚本操作
2016/11/04 Python
python 网络编程详解及简单实例
2017/04/25 Python
python读取LMDB中图像的方法
2018/07/02 Python
python 递归深度优先搜索与广度优先搜索算法模拟实现
2018/10/22 Python
Python编程图形库之Pillow使用方法讲解
2018/12/28 Python
Python3 pip3 list 出现 DEPRECATION 警告的解决方法
2019/02/16 Python
python pandas cumsum求累计次数的用法
2019/07/29 Python
Pytest单元测试框架如何实现参数化
2020/09/05 Python
HTML5 progress和meter控件_动力节点Java学院整理
2017/07/06 HTML / CSS
英国著名的药妆网站:Escentual
2016/07/29 全球购物
海信商城:海信电视、科龙空调、容声冰箱官方专卖
2017/02/07 全球购物
会计电算化专业应届大学生求职信
2013/10/22 职场文书
工程造价与管理专业应届生求职信
2013/11/23 职场文书
2015年学校教科室工作总结
2015/07/20 职场文书
python前后端自定义分页器
2022/04/13 Python
详解Python中的for循环
2022/04/30 Python
MySQL详解进行JDBC编程与增删改查方法
2022/06/16 MySQL