How to freeze packages installed only in the virtual environment?

saul.shanabrook picture saul.shanabrook · Nov 10, 2011 · Viewed 40.3k times · Source

How to freeze packages installed only in the virtual environment, that is, without the global ones?

Answer

Muneeb Ali picture Muneeb Ali · Jul 2, 2013

You need to use the -l or --local option to freeze only the local packages (and not the global ones)

pip freeze -l > requirements.txt 

Make sure you are working in the virtualenv before doing pip freeze -l.