Find all packages installed with easy_install/pip?

Find all packages installed with easy_install/pip?

Asked on November 9, 2018 in Python.
Add Comment


  • 3 Answer(s)

         pip freeze can output a listing of put in packages and their versions. It additionally permits you to write down those packages to a file that may later be wont to created a replacement atmosphere.

     

    Answered on November 9, 2018.
    Add Comment

    If anyone is curious you’ll use the ‘pip show’ command.

    pip show [options] <package>
    
    

    This will list the install directory of the given package in python.

     

    Answered on November 9, 2018.
    Add Comment

    Here the pip.get_installed_distributions() will give a list of installed packages as shown

    import pip
    from os.path import join
    for package in pip.get_installed_distributions():
        print(package.location) # you can exclude packages that's in /usr/XXX
        print(join(package.location, package._get_metadata("top_level.txt"))) # root directory of this package
    
    Answered on November 9, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.