pip3 的关键选项之一是--upgrade. 那为什么不pip3 help描述呢?
进行网络搜索以了解如何使用 pip3 升级 Python 3 包。有大量的答案,包括但不限于如何更新 Python 包?,所有的一般形式:
sudo pip install [package_name] --upgrade
观察该命令行中是否存在该选项--upgrade。
输入pip3 help 响应:
Usage:
pip3 <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 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> 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.
--no-color Suppress colored output
Run Code Online (Sandbox Code Playgroud)
请注意,该单词upgrade不在该选项列表中。
只想确认一下:
类型pip3 help | grep upgrade。结果:
找到零次出现。
可能有一个--upgrade被排除在 pip3 之外的原因help。
那是什么原因呢?
它列在pip install --help:
$ pip install --help | grep upgrade
<dir>. Use --upgrade to replace existing
-U, --upgrade Upgrade all specified packages to the newest
depends on the upgrade-strategy used.
--upgrade-strategy <upgrade_strategy>
dependencies are upgraded regardless of whether
requirements of the upgraded package(s). "only-
if-needed" - are upgraded only when they do not
satisfy the requirements of the upgraded
Run Code Online (Sandbox Code Playgroud)
下面的标志pip --help是常规选项。
| 归档时间: |
|
| 查看次数: |
884 次 |
| 最近记录: |