Pip freeze vs. pip list

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

    The main difference is that the output of pip freeze can be dumped into a requirements.txt file and used later to re-construct the "frozen" environment.

    In other words you can run: pip freeze > frozen-requirements.txt on one machine and then later on a different machine or on a clean environment you can do: pip install -r frozen-requirements.txt and you'll get the an identical environment with the exact same dependencies installed as you had in the original environment where you generated the frozen-requirements.txt.

提交回复
热议问题