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

How to view the package directory installed by Python pip?

WBOY
WBOYforward
2023-04-24 21:58:065393browse

    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

    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;
    >>> help(requests)
    ...
    VERSION
        2.19.1
     
    AUTHOR
        Kenneth Reitz
    
    FILE
        d:\program files\python-3.7.0\lib\site-packages\requests\__init__.py
    ...

    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!

    Statement:
    This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete