python 用命令安装pip_Python开发之pip安装及使用方法详解

本文详细介绍了Python的包管理工具pip,包括pip的功能、安装方法、常用命令如`install`、`uninstall`、`freeze`、`list`和`show`等。pip用于安装、升级和管理Python包,它支持从PyPI、版本控制、本地项目安装。此外,还提到了如何通过`pip install`指定版本号进行安装。
摘要由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进行安装。

然后直接运行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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值