packages discoverer

Cameron Simpson cs at cskk.id.au
Sat Jul 17 21:35:18 EDT 2021


On 18Jul2021 00:53, jak <nospam at please.ty> wrote:
>Sometimes, wandering around the web, I find some example of python code
>that uses some class or function that I don't know and that I would like
>to try. I copy the code locally and when I try to run it, I find that
>the package containing the class/function is not installed on my pc, so
>I go back to the web to search for it with the search engine. The
>question is: is there a command or an easy way to find out the name of
>the package that contains the class/function of my interest?

Usually a third party package will be in PyPI: https://pypi.org/

If the import line of the unknown function looks like this:

    from package_name import function_name

you should be able to search for it there. Or, of course:

    python -m pip install --user package_name

to install it in your local Python environment, ready for use.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list