Python/pip:修订间差异
来自康健生活
< Python
| 第40行: | 第40行: | ||
pip uninstall -r requirements.txt -y</syntaxhighlight>|$|/home/kangkk}} | pip uninstall -r requirements.txt -y</syntaxhighlight>|$|/home/kangkk}} | ||
== 参数 == | == 参数 == | ||
<code>--upgrade</code>: 更新。 | * <code>--upgrade</code>: 更新。 | ||
<code>--user</code>: 仅当前安装的用户可用。 | * <code>--user</code>: 仅当前安装的用户可用。 | ||
== other == | == other == | ||
2022年1月11日 (二) 03:14的版本
安装PIP
安装
easy_inatall 安装
/home/kangkk
easy_inatall pip
编译安装
/home/kangkk
wget https://files.pythonhosted.org/packages/8e/76/66066b7bc71817238924c7e4b448abdb17eb0c92d645769c223f9ace478f/pip-20.0.2.tar.gz
setuptools 安装
pypi 官网下载 setuptools 压缩包
/home/kangkk
wget https://files.pythonhosted.org/packages/b5/96/af1686ea8c1e503f4a81223d4a3410e7587fd52df03083de24161d0df7d4/setuptools-46.1.3.zip
/home/kangkk
python setup.py install
卸载
/home/kangkk
python -m pip uninstall pip
pip-autoremove
/home/kangkk
pip install pip-autoremove
pip-autoremove package-name-here
升级
/home/kangkk
python -m pip install --upgrade pip
# or update pip3
pip3 install --upgrade pip
清理 pip
1. 导出所有包
/home/kangkk
pip freeze > requirements.txt
2. 删除所有包
/home/kangkk
pip uninstall -r requirements.txt
# or
pip uninstall -r requirements.txt -y
参数
--upgrade: 更新。--user: 仅当前安装的用户可用。
other
列出所有安装的库
/home/kangkk
pip list
列出所有过期的库
/home/kangkk
pip list --outdated
批量更新库
update.py
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
或者使用 pip-review
/home/kangkk
pip install pip-review
pip-review --local --interactive
No categories