Python/pip:修订间差异
来自康健生活
无编辑摘要 |
|||
| 第36行: | 第36行: | ||
# or | # or | ||
pip uninstall -r requirements.txt -y</syntaxhighlight>|$|/home/kangkk}} | pip uninstall -r requirements.txt -y</syntaxhighlight>|$|/home/kangkk}} | ||
== 参数 == | |||
<code>--upgrade</code>: 更新。 | |||
<code>--user</code>: 仅当前安装的用户可用。 | |||
== other == | |||
列出所有安装的库 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
pip list</syntaxhighlight>|$|/home/kangkk}} | |||
列出所有过期的库 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
pip list --outdated</syntaxhighlight>|$|/home/kangkk}} | |||
批量更新库 | |||
{{Hc|update.py|<syntaxhighlight lang="python"> | |||
import pip | |||
from subprocess import call | |||
for dist in pip.get_installed_distributions(): | |||
call("pip install --upgrade " + dist.project_name, shell=True)</syntaxhighlight>}} | |||
或者使用 pip-review | |||
{{shc|<syntaxhighlight lang="bash"> | |||
pip install pip-review | |||
pip-review --local --interactive</syntaxhighlight>|$|/home/kangkk}} | |||