windows系统安装pip记录

发表于: python | 作者: darkmi | 日期: 2018/01/24 08:00
标签: pip
字号:

pip简介
pip是python的包管理工具。

项目主页:https://pypi.python.org/pypi/pip

下载后安装
下载后解压,通过CMD终端进入解压的目录,然后输入以下命令:

python setup.py install

接下来设置环境变量
将 D:\program\Python\Python36\Scripts 添加至PATH,注意格式并替换你自己的python安装目录。

验证安装

C:\Users\mixh>pip list
DEPRECATION: The default format will switch to columns in the future. You can us
e --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.con
f under the [list] section) to disable this warning.
lxml (4.1.1)
pip (9.0.1)
setuptools (28.8.0)

pip设置代理

安装包时设置代理的格式:

pip install --proxy http://username:password@proxyIP:proxyPort sphinx

我所在局域网的代码不用设置密码,故使用如下命令即可:

C:\Users\darkmi>pip install --proxy http://proxy.it.xxx.com:8080 nose
Collecting nose
  Downloading nose-1.3.7-py3-none-any.whl (154kB)
    39% |████████████▊                   | 61kB 285kB/s eta 0:00:01
    46% |██████████████▉                 | 71kB 305kB/s eta 0:00:
    52% |█████████████████               | 81kB 326kB/s eta 0:0
    59% |███████████████████             | 92kB 362kB/s eta 0
    66% |█████████████████████▏          | 102kB 389kB/s e
    72% |███████████████████████▎        | 112kB 509kB/s
    79% |█████████████████████████▍      | 122kB 585kB
    86% |███████████████████████████▌    | 133kB 664
    92% |█████████████████████████████▋  | 143kB 8
    99% |███████████████████████████████▊| 153kB
    100% |████████████████████████████████| 163k
B 736kB/s
Installing collected packages: nose
Successfully installed nose-1.3.7

pip的使用很简单,看一下帮助文档即可使用。

C:\Users\mixh>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 dependen
cies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  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.
  --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 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.

官方的安装教程:https://pip.pypa.io/en/stable/installing/

切换主题切换主题
返回顶部