pythonpip使用方法_Python开发之pip安装及使用方法详解

本文介绍了Python的包管理工具pip,它用于管理和安装Python标准库中的其他包。pip支持从PyPI、版本控制、本地项目及直接安装。从Python 2.7.9和3.4版本开始,pip已内置。内容包括pip的安装方法,如通过get-pip.py脚本安装,以及pip的常用命令和选项,如安装、卸载、查看已安装包等。
摘要由CSDN通过智能技术生成

pip是什么

其实,pip就是 Python标准库(The Python Standard Library)中的一个包,这个包比较特殊,用它可以来管理Python标准库(The Python Standard Library)中其他的包。pip支持从PyPI(https://pypi.org/ ),版本控制,本地项目以及直接从分发文件进行安装。pip是一个命令行程序。 安装pip后,会向系统添加一个pip命令,该命令可以从命令提示符运行。

目前,pip 是The Python Packaging Authority (PyPA) 推荐的 Python 包管理工具!

The Python Packaging Authority (PyPA) is a working group that maintains many of the relevant projects in Python packaging.

pip安装

从 Python 2 版本 >=2.7.9 或 Python 3 版本 >=3.4 开始,官网的安装包中已经自带了 pip,在安装时用户可以直接选择安装。或者如果使用由 virtualenv 或者 pyvenv 创建的 Virtual Environment,那么 pip 也是被默认安装的。

如果没有在安装python时候,选择上"安装pip"选项,那么也可以从本地安装。例如,直接使用get-pip.py进行安装。

首先从官网下载get-pip.py;

然后直接运行python get-pip.py即可;

pip使用

安装后,在命令行中键入:pip+ 回车,就会出现如下使用说明:

Usage:

pip [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.

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 to a verbose appending log.

--proxy Specify a proxy in the form [user:passwd@]proxy.server:port.

--retries Maximum number of retries each connection should attempt (default 5 times).

--timeout Set the socket timeout (default 15 seconds).

--exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,

(a)bort).

--trusted-host Mark this host as trusted, even though it does not have valid or any HTTPS.

--cert Path to alternate CA bundle.

--client-cert Path to SSL client certificate, a single file containing the private key and the

certificate in PEM format.

--cache-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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值