打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
windows下pip包管理工具基本命令操作

#升级pip包管理工具

C:\Users\Administrator>python -m pip install --upgrade pip    

Looking in indexes: http://mirrors.aliyun.com/pypi/simple

Collecting pip

  Downloading http://mirrors.aliyun.com/pypi/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/p

     |████████████████████████████████| 1.5MB 1.7MB/s

Installing collected packages: pip

  Found existing installation: pip 19.2.3

    Uninstalling pip-19.2.3:

      Successfully uninstalled pip-19.2.3

Successfully installed pip-20.2.4

#pip检查哪些包需要更新

C:\Users\Administrator>pip list --outdated   

Package    Version Latest Type

---------- ------- ------ -----

setuptools 41.2.0  50.3.2 wheel

C:\Users\Administrator>

#通过 pip升级包 setuptools

C:\Users\Administrator>pip install --upgrade setuptools

Looking in indexes: http://mirrors.aliyun.com/pypi/simple

Collecting setuptools

  Downloading http://mirrors.aliyun.com/pypi/packages/6d/38/c21ef5034684ffc0412deefbb07d66678332290c14bb5269c85145fbd55e/setuptools-50.3.2-py3-none-any.whl (785 kB)

     |████████████████████████████████| 785 kB 1.7 MB/s

Installing collected packages: setuptools

  Attempting uninstall: setuptools

    Found existing installation: setuptools 41.2.0

    Uninstalling setuptools-41.2.0:

      Successfully uninstalled setuptools-41.2.0

Successfully installed setuptools-50.3.2

C:\Users\Administrator>

#通过pip安装 requests 包

C:\Users\Administrator>pip install requests      

Looking in indexes: http://mirrors.aliyun.com/pypi/simple

Collecting requests

  Downloading http://mirrors.aliyun.com/pypi/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl (61kB)

     |████████████████████████████████| 71kB 2.3MB/s

Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests)

  Downloading http://mirrors.aliyun.com/pypi/packages/56/aa/4ef5aa67a9a62505db124a5cb5262332d1d4153462eb8fd89c9fa41e5d92/urllib3-1.25.11-py2.py3-none-any.whl (127kB)

     |████████████████████████████████| 133kB 1.6MB/s

Collecting chardet<4,>=3.0.2 (from requests)

  Downloading http://mirrors.aliyun.com/pypi/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)

     |████████████████████████████████| 143kB 2.2MB/s

Collecting idna<3,>=2.5 (from requests)

  Downloading http://mirrors.aliyun.com/pypi/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl (58kB)

     |████████████████████████████████| 61kB 4.1MB/s

Collecting certifi>=2017.4.17 (from requests)

  Downloading http://mirrors.aliyun.com/pypi/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (156kB)

     |████████████████████████████████| 163kB 2.2MB/s

Installing collected packages: urllib3, chardet, idna, certifi, requests

Successfully installed certifi-2020.6.20 chardet-3.0.4 idna-2.10 requests-2.24.0 urllib3-1.25.11

WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.

You should consider upgrading via the 'python -m pip install --upgrade pip' command.

#pip查看是否已安装

C:\Users\Administrator>pip show requests

Name: requests         #包名

Version: 2.24.0        #版本号

Summary: Python HTTP for Humans.

Home-page: https://requests.readthedocs.io

Author: Kenneth Reitz

Author-email: me@kennethreitz.org

License: Apache 2.0

Location: d:\python\python38\lib\site-packages   #包安装位置

Requires: urllib3, chardet, idna, certifi

Required-by:

C:\Users\Administrator>

#安装Redis 是一个开源(BSD许可)的,内存中的数据结构存储系统,它可以用作数据库、缓存和消息中间件。

C:\Users\Administrator>pip install redis

Looking in indexes: http://mirrors.aliyun.com/pypi/simple

Collecting redis

  Downloading http://mirrors.aliyun.com/pypi/packages/a7/7c/24fb0511df653cf1a5d938d8f5d19802

     |████████████████████████████████| 72 kB 213 kB/s

Installing collected packages: redis

Successfully installed redis-3.5.3

C:\Users\Administrator>

#卸载 redis 包

C:\Users\Administrator>pip uninstall redis

Found existing installation: redis 3.5.3

Uninstalling redis-3.5.3:

  Would remove:

    d:\python\python38\lib\site-packages\redis-3.5.3.dist-info\

    d:\python\python38\lib\site-packages\redis\*

Proceed (y/n)? y

  Successfully uninstalled redis-3.5.3

C:\Users\Administrator>

#pip帮助参数解释

C:\Users\Administrator>pip --help

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 to WARNING, 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 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.

  --no-color                  Suppress colored output

  --no-python-version-warning

                              Silence 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.

C:\Users\Administrator>

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
如何将Python项目发布到PyPI
PIP知识文档
几个Python配置工具简介:setuptools、pip、virtualenv
教程|花了半天给大家总结的Python包管理工具快速入门教程
ImportError: No module named pkg
python安装后无scripts内文件,无法使用pip
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服