Home > Backend Development > Python Tutorial > How to view the package directory installed by Python pip?

How to view the package directory installed by Python pip?

WBOY
Release: 2023-04-24 21:58:06
forward
5450 people have browsed it

    Where to put the packages installed by python pip

    • Use pip list to view the installed package names

    • Then use pip show package name, you can see where it is installed

    Usually installed in the lib/site-packages directory under the python installation directory!

    Determine the location of the site-packages directory in the current Python environment

    How does Python check its own default installation path of third-party libraries

    python -m site
    Copy after login

    Without pip, Python is listed in Extract all installed software packages

    In the python interactive interface, enter

    help('modules')

    According to the echo
    Enter the specific module name to get the help information of this module

    help('grpc')

    Start the python command line and enter the following two lines of commands
    import networkx
    networkx.version

    >>> import requests
    >>> requests.__version__
    '2.19.1'
    >>> import datetime
    >>> datetime.__version__
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: &#39;module&#39; object has no attribute &#39;__version__&#39;
    Copy after login
    >>> help(requests)
    ...
    VERSION
        2.19.1
     
    AUTHOR
        Kenneth Reitz
    
    FILE
        d:\program files\python-3.7.0\lib\site-packages\requests\__init__.py
    ...
    Copy after login

    Extension: Python Check the location of the package installed by pip (check the path of the pip installation package)

    • The pip list | grep package_name command displays and obtains the information of the installed package (package name and version number)

    • The pip show package_name command can display the relevant information of the installed package, including its installation path. In fact, packages are usually installed in the lib\site-packages directory under the python installation directory

    The above is the detailed content of How to view the package directory installed by Python pip?. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:yisu.com
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template