Excluding global installed pip packages from requirements.txt

Privalov Vladimir
1 min readAug 4, 2020

--

It’s a common best practice to save all the installed python packages in the virtualenv to requirements.txt file. You use command

pip freeze > requirements.txt

for this purpose. However there is a problem with this command: all global python packages installed in system will fall in this file so requirements.txt will be very long.

We can use flag local to overtake this effect

pip freeze --local > requirements.txt

This will create requirements.txt listing only local packages for current virtualenv.

--

--

No responses yet