博客简介
本篇博客主要介绍的是如何下载安装第三方库,包括如何搜索到第三方库生态中的所有库,如何用pip安装方法安装第三方库,以及pip常用指令简介
全球第三方库生态
我们也许经常看到博客上,github,公众号,论文,知乎…有各种眼花缭乱的第三方库,那么这些库都是哪里来的?当然有许多大牛自己写的库,但是大多数还是是用的全球第三方库生态中的库:
- 全球第三方库生态:https://pypi.org/
在这里,你可以通过搜索框找到全球优秀的第三方库
pip常用指令简介
如何安装这些库?最常用的方法是pip安装,打开命令行,输入相应指令:
Commands:
- install : Install packages.
- download : Download packages.
- uninstall : Uninstall packages.
- reeze : Output installed packages in requirements format.
- ist : 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.
- debug : Show information useful for debugging.
- 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 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的问题
在使用pip安装第三方库依赖于网络,首先你的计算机必须联网,但是有时会出现Socket超时的问题,这时不妨试一试打开手机热点,再进行安装.