[portland] A homebrew-ed Python + virtualenv + virtualenvwrapper question

Miguel Grinberg miguelgrinberg50 at gmail.com
Thu May 1 01:19:38 CEST 2014


Hi John,

I consider virtualenvs disposable, and by that I mean that I always ensure that I can regenerate them easily. For each virtualenv I keep a requirements file that lists all the packages I have installed including indirect dependencies, and with the exact version numbers. I update this file whenever I make changes to a virtualenv. Then when a virtualenv stops working for any reason I just regenerate it.

To export a requirements file you can use this command (note this must be done on a working virtualenv):

$ pip freeze > requirements.txt

To populate a virtualenv from a requirements file use this command after activating it:

$ pip install -r requirements.txt

I hope this helps.

Miguel

----- Original Message -----
From: John Heasly <jheasly at earthlink.net>
To: portland at python.org
Date: Wed, 30 Apr 2014 13:25:05 -0700
Subject: [portland] A homebrew-ed Python + virtualenv + virtualenvwrapper question

> Hello all,
> 
> I’ve been bit by creating virtualenvs against a homebrew-installed systemwide Python, upgrading the system Python, running "brew cleanup” which deletes the previous Python that the virtualenv was created against. Is there a way to get virtualenvs to “see” the new Python? Or should I just stop with the “brew cleanup” after brew upgrading the system Python?
> 
> I figure this is a common enough scenario that there has to be a good answer/best practice/light to dim the darkness of my ignorance.
> 
> Thanks,
> John
> _______________________________________________
> Portland mailing list
> Portland at python.org
> https://mail.python.org/mailman/listinfo/portland
> 


More information about the Portland mailing list