Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57861

Re: How do I update a virtualenv?

Date 2013-10-28 20:13 -0400
From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: How do I update a virtualenv?
References <CANc-5Uy367Mu-zN30Z8xKfE_Zf9q4G15E_oVtB+HOWPja6MNag@mail.gmail.com> <526EF04A.6070702@nedbatchelder.com> <CANc-5UxvR=woVE19a14rTAKX4qwzdPEVgoj0XxX169DU_uKMWw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1731.1383006012.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 10/28/13 7:53 PM, Skip Montanaro wrote:
>> Virtualenvs aren't built to be moved from one Python installation to
>> another.  If you used pip to install your packages (you should), then you
>> can activate the virtualenv, and run: $ pip freeze > requirements.txt
>>
>> Then you can create a new virtualenv using the new Python executable,
>> activate it, and:  $ pip install -r requirements.txt
>>
>> This will reinstall all the packages you had installed previously. Even
>> better is to maintain your own requirements.txt that has just the packages
>> you need.  The "pip freeze" technique will also list packages installed as
>> dependencies.
> Hmmm... And my git repo?
Usually the virtualenv is outside the git repo (and vice-versa), but git 
repos are also easy to recreate from the git server if you need to.  
Maybe I don't understand what you mean?

> I imagine I will eventually figure this out,
> but updating an existing virtualenv in place to adapt to a new version
> of Python (say, a new micro) or some of its libraries (contents of
> requirements.txt) seems like it would be a very nice thing to have.

"pip install --upgrade" will upgrade your Python packages.  "pip install 
-r requirements.txt"  will install new packages or versions named in the 
requirements.txt file.

> Skip

--Ned.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: How do I update a virtualenv? Ned Batchelder <ned@nedbatchelder.com> - 2013-10-28 20:13 -0400
  Re: How do I update a virtualenv? Roy Smith <roy@panix.com> - 2013-10-28 20:48 -0400

csiph-web