Python:如何安装与使用 pip

pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.8 downloaded from python.org or if you are working in a Virtual Environment created by virtualenv or pyvenv. Just make sure to upgrade pip.

升级 pip

On Linux or macOS:

pip install -U pip

On Windows:

python -m pip install -U pip

查看 pip 版本

pip -V
// 或者
pip --version
// 结果
pip 20.2.4 from c:\program files\python\python39\lib\site-packages\pip (python 3.9)

列出 pip 已安装的包

pip list
// 结果
Package    Version
---------- -------
pip        20.2.4
setuptools 49.2.1

显示安装包信息

// pip show SomePackage Name
pip show setuptools
// 结果
Name: setuptools
Version: 49.2.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: c:\program files\python\python39\lib\site-packages
Requires:
Required-by:

查看可升级的包

pip list -o
// 结果
Package    Version Latest Type
---------- ------- ------ -----
setuptools 49.2.1  50.3.2 wheel

升级包

pip install --upgrade SomePackage

安装包

pip install SomePackage              # 最新版本
pip install SomePackage==1.0.4       # 指定版本
pip install 'SomePackage>=1.0.4'     # 最小版本

比如我要安装 Python。用以下的一条命令就可以,方便快捷。

pip install Python==3.9

升级包

pip install --upgrade SomePackage

升级指定的包,通过使用==, >=, <=, >, < 来指定一个版本号。

卸载包

pip uninstall SomePackage

查看已安装的包及版本信息

pip freeze

导出已经安装包及版本信息到指定文件中,文件名称随意。

pip freeze > E:\requirements.txt

根据 requirements.txt 安装指定包

pip install -r E:\requirements.txt

搜索包

pip search <搜索关键字>

使用pip –help命令可以查看pip帮助手册

Usage:pip <command> [options]Commands:install                     Install packages.download                    Download packages.uninstall                   Uninstall packages.freeze                      Output installed packages in requirements format.list                        List installed packages.show                        Show information about installed packages.check                       Verify installed packages have compatible dependencies.config                      Manage local and global configuration.search                      Search PyPI for packages.cache                       Inspect and manage pip's wheel cache.wheel                       Build wheels from your requirements.hash                        Compute hashes of package archives.completion                  A helper command used for command completion.debug                       Show information useful for debugging.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. Option is additive, and can be used up to 3 times (corresponding toWARNING, ERROR, and CRITICAL logging levels).--log <path>                Path to a verbose appending log.--no-input                  Disable prompting for input.--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,(a)bort.--trusted-host <hostname>   Mark this host or host:port pair as trusted, even though it does not have valid or anyHTTPS.--cert <path>               Path to alternate CA bundle.--client-cert <path>        Path to SSL client certificate, a single file containing the private key and thecertificate in PEM format.--cache-dir <dir>           Store the cache data in <dir>.--no-cache-dir              Disable the cache.--disable-pip-version-checkDon't periodically check PyPI to determine whether a new version of pip is available fordownload. Implied with --no-index.--no-color                  Suppress colored output.--no-python-version-warningSilence deprecation warnings for upcoming unsupported Pythons.--use-feature <feature>     Enable new functionality, that may be backward incompatible.--use-deprecated <feature>  Enable deprecated functionality, that will be removed in the future.

Python:如何安装与使用 pip相关推荐

  1. “解决Python软件包安装问题 - 修改pip源地址“

    "解决Python软件包安装问题 - 修改pip源地址" 在使用Python开发中,我们经常需要安装各种各样的第三方库,而 pip 就是 Python 软件包的安装和管理工具.但是 ...

  2. Python 库安装方法:pip安装tar.gz压缩包,pip安装whl文件

    Python 库安装方法 第一章:标准安装 ① Python 安装 tar.gz 压缩包 ② Python 安装 whl 文件 第二章:失败异常处理 ① whl 安装失败:whl is not a s ...

  3. Python | freeze | 如何将Python已安装的库(pip list)导入与导出

    1. 导出 查看当前安装的包 pip list 导出当前安装的包记录 pip freeze > ./requirements.txt 2. 导入 用anaconda创建一个虚拟环境 conda ...

  4. Python + selenium 安装问题,pip install selenium失败及解决方法

    最近想要是使用Python 访问下浏览器,网上关于这些东西都很多,Python 安装和 selenium 的下载就不赘述,这里简单总结一下第一次安装Python + selenium中遇到的问题. 1 ...

  5. python怎么安装tensorflow-Python使用pip安装TensorFlow模块

    1.首先确保已经安装python,然后用pip来安装matplotlib模块. 2.进入到cmd窗口下,建议执行python -m pip install -U pip setuptools进行升级. ...

  6. Python 库安装问题-用pip安装pyHook3报错的两种常见问题和解决方法

    pip install pyHook3 来安装 pyHook3,但是安装报错了. 问题一:缺少swig支持 我们来看报错信息,提示没有找到 swig.exe 这个文件. 原因是没有安装 swig.ex ...

  7. python安装pip-安装pip的三种方法

    1.get-pip.py安装 $wget https://bootstrap.pypa.io/get-pip.py $ sudo python get-pip.py # 运行安装脚本 注意:用哪个版本 ...

  8. python编程基础(二)~python安装设置 和 pip packages安装与使用

    目录 背景 1. 手动安装python.更改mac默认python版本 2. 手动安装pip 3. 安装package 4. package的导入 5. 升级.降级.更新package 6. 删除pa ...

  9. python怎么安装pip

    pip 是 Python 包管理工具,通过pip工具我们能够快速的安装Python扩展包,包括下载.安装.卸载等等步骤,但一些老版本的Python没有安装pip工具,今天小千就来教大家如何去查看和安装 ...

  10. python一键安装神器_超级实用的Python环境搭建以及神器推荐!抓紧时间收藏

    今天给大家讲一下如何搭建一个舒适的 Python 环境,包括本地环境和远程调试环境,然后再附送给大家两套好用的 Python Web 框架.在这个过程中,还穿插着介绍一些适合于初学者的神器,希望大家中 ...

最新文章

  1. python【力扣LeetCode算法题库】104-二叉树的最大深度
  2. Eclipse-配置workspace路径
  3. fso 拒绝访问_让虚拟主机免受FSO威胁(转)
  4. LeetCode 680. 验证回文字符串 Ⅱ
  5. 【计算机科学基础】控制复杂性的艺术
  6. 关于scanf 与 cin gets(),getline()......输入输出字符串的区别
  7. 2021永州高中高考成绩查询入口,邵阳高考成绩查询入口2021
  8. 动态字段无法双向绑定_ASP.NET Core Blazor Webassembly 之 数据绑定
  9. oracle错误代码及解决办法整合
  10. qt txt快速转excel
  11. 什么类型网站不利于seo优化
  12. android手机常用浏览器,Android手机 三大浏览器对比评测
  13. 2016,我有些明白了
  14. Python求向量的余弦值
  15. 镭速传输:TB级大文件传输,一招教你搞定
  16. Python报错不要慌,这三个关键词帮你解决问题!
  17. X站全称是什么_工作中学习-没有校惯导之前为什么PFD不显示飞机姿态,而IFSD却能显示...
  18. opencv 稀疏光流 稠密光流
  19. PyQt5 作图之 pyqtgraph PlotWidget 代码结构拆解
  20. 手机上的磁性传感技术

热门文章

  1. css 精灵图的使用
  2. 1.3计算机硬件的主要指标
  3. [Hive]-DataBase
  4. 爬虫(十五):scrapy中的settings详解
  5. Win10 iot 配置防火墙限制应用部署
  6. RAR 5.50 控制台使用记录
  7. HDU 1114 iggy-Bank(完全背包)
  8. Dynamics CRM2013 Server2012R2下IFD部署遇到There is already a listener on IP endpoint的解决方法...
  9. 为什么不能在scrollview中直接添加一个image,然后使animation.begin()??
  10. Linux之ab命令