查看pip信息
pip show pip
pip的常用命令说明
(base) C:\Users\Lenovo>pip help
Usage:
pip <command> [options]
Commands:
install 安装.
download 下载.
uninstall 卸载.
freeze 以指定格式输出已安装的包.
list 已安装包的列表.
show 显示已安装包的信息.
check 验证已安装包具有兼容的依赖项.
config 管理本地和全局配置.
search 在PyPI中搜索包.
wheel 根据您的需求构建轮wheel.
hash 计算包存档的哈希值.
completion 用于命令自动补全.
debug 显示对调试有用的信息.
help 显示命令的帮助.
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 or host:port pair 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
--no-python-version-warning
Silence deprecation warnings for upcoming unsupported Pythons.
升级pip
python -m pip install --upgrade pip
列出当前包与最新包版本信息
pip list --outdated
安装包
pip install 包名
升级指定的包
pip install --upgrade 包名
安装指定 3.0.4 版本的 astropy 包
pip install astropy==3.0.4
注:astropy 4.0 不再支持 from astropy.extern import six,而是需要 import six
错误解决方法:
错误一
TypeError: object of type class ‘numpy.float64’ cannot be safely interpreted as an integer.
解决方法:
numpy 1.18.1 -> numpy 1.15.1