如何使用 pip 搜索可用的 Python 包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17373473/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 08:01:41  来源:igfitidea点击:

How do I search for an available Python package using pip?

pythonpip

提问by CodeKingPlusPlus

I would like to be able to search for an available Python package using pip(on the terminal). I would like a functionality similar to apt-cachein Ubuntu. More specifically, I would like to

我希望能够使用pip(在终端上)搜索可用的 Python 包。我想要一个类似于apt-cacheUbuntu的功能。更具体地说,我想

  1. be able to search for packages given a term (similar to apt-cache search [package-name]), and
  2. list all available packages.
  1. 能够搜索给定术语的包(类似于apt-cache search [package-name]),以及
  2. 列出所有可用的包。

采纳答案by ijmarshall

To search for a package, issue the command

要搜索包,请发出命令

pip search [package-name]

回答by Daniel Hepper

  1. To search use pip search QUERY

    Use pip helpand pip help COMMANDto learn about all available commands and their options.

  2. You can find a complete list of packages here:

    https://pypi.python.org/pypi/

    Note the trailing slash! Without it you will end up on a different page.

    A index with simpler markup for easier automatic consumption can be found here:

    https://pypi.python.org/simple/

  1. 搜索使用 pip search QUERY

    使用pip helppip help COMMAND了解所有可用命令及其选项。

  2. 您可以在此处找到完整的软件包列表:

    https://pypi.python.org/pypi/

    注意尾部斜线!没有它,您将进入不同的页面

    可以在此处找到具有更简单标记以便于自动使用的索引:

    https://pypi.python.org/simple/

回答by bcarroll

To see a list of all available packages try running

要查看所有可用包的列表,请尝试运行

pip search *

回答by Balázs Sáros

Pip search can solve your problem if you don't want to use it too often. But after regular use I found it hard to read, slow to use and it didn't show infos I sometimes needed (upload time, license, size, etc) so I ended up writing an alternative which I think turned out pretty nice.

如果您不想经常使用 Pip 搜索,它可以解决您的问题。但是在经常使用之后,我发现它很难阅读,使用很慢,而且它没有显示我有时需要的信息(上传时间、许可证、大小等),所以我最终写了一个我认为非常好的替代方案。

It is called yip and it is like pip search on steroids. It supports regex search, colorized output and a menu system which makes installing from search result super easy. If you want to know more or see a screencap check it out on GitHub.

它被称为 yip,它就像在类固醇上进行 pip 搜索。它支持正则表达式搜索、彩色输出和菜单系统,这使得从搜索结果安装变得非常容易。如果您想了解更多信息或查看屏幕截图,请在 GitHub 上查看