Pip freeze vs. pip list

前端 未结 5 1293
鱼传尺愫
鱼传尺愫 2020-12-04 06:58

A comparison of outputs reveals differences:

user@user-VirtualBox:~$ pip list
feedparser (5.1.3)
pip (1.4.1)
setuptools (1.1.5)
wsgiref (0.1.2)
user@user-Vir         


        
5条回答
  •  情深已故
    2020-12-04 07:21

    pip list shows ALL installed packages.

    pip freeze shows packages YOU installed via pip (or pipenv if using that tool) command in a requirements format.

    Remark below that setuptools, pip, wheel are installed when pipenv shell creates my virtual envelope. These packages were NOT installed by me using pip:

    test1 % pipenv shell
    Creating a virtualenv for this project…
    Pipfile: /Users/terrence/Development/Python/Projects/test1/Pipfile
    Using /usr/local/Cellar/pipenv/2018.11.26_3/libexec/bin/python3.8 (3.8.1) to create virtualenv…
    ⠹ Creating virtual environment...
    
    Installing setuptools, pip, wheel...
    done.
    ✔ Successfully created virtual environment! 
    
    

    Now review & compare the output of the respective commands where I've only installed cool-lib and sampleproject (of which peppercorn is a dependency):

    test1 % pip freeze       <== Packages I'VE installed w/ pip
    
    -e git+https://github.com/gdamjan/hello-world-python-package.git@1071#egg=cool_lib
    peppercorn==0.6
    sampleproject==1.3.1
    
    
    test1 % pip list         <== All packages, incl. ones I've NOT installed w/ pip
    
    Package       Version Location                                                                    
    ------------- ------- --------------------------------------------------------------------------
    cool-lib      0.1  /Users/terrence/.local/share/virtualenvs/test1-y2Zgz1D2/src/cool-lib           <== Installed w/ `pip` command
    peppercorn    0.6       <== Dependency of "sampleproject"
    pip           20.0.2  
    sampleproject 1.3.1     <== Installed w/ `pip` command
    setuptools    45.1.0  
    wheel         0.34.2
    

提交回复
热议问题