Pip freeze vs. pip list

前端 未结 5 1303
鱼传尺愫
鱼传尺愫 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:17

    When you are using a virtualenv, you can specify a requirements.txt file to install all the dependencies.

    A typical usage:

    $ pip install -r requirements.txt
    

    The packages need to be in a specific format for pip to understand, which is

    feedparser==5.1.3
    wsgiref==0.1.2
    django==1.4.2
    ...
    

    That is the "requirements format".

    Here, django==1.4.2 implies install django version 1.4.2 (even though the latest is 1.6.x). If you do not specify ==1.4.2, the latest version available would be installed.

    You can read more in "Virtualenv and pip Basics", and the official "Requirements File Format" documentation.

提交回复
热议问题