[Tutor] Can a virtual environment be renamed?

Mats Wichmann mats at wichmann.us
Sun Apr 16 15:18:45 EDT 2017


On 04/16/2017 10:16 AM, Jim wrote:
> On 04/16/2017 10:10 AM, Chris Warrick wrote:
>> On 16 April 2017 at 16:45, Jim <jf_byrnes at comcast.net> wrote:
>>> My system python is 2.7.12 so I created a virtual environment using
>>> venu to
>>> run 3.5.2. I put it in /home/jfb/EVs/env. Now I would like to try 3.6
>>> and
>>> put it in env36. Is it possible to change env to env35 for 3.5.2 without
>>> breaking things?
>>
>> No. You need to delete your existing virtualenv and create a new one.
>> You can just use `pip freeze > requirements.txt` in the old one and
>> run `pip install -r requirements.txt` in the new one to ”move” all the
>> packages you had.
>>
>>
> 
> Thanks Chris. I thought that would be the answer but wanted to check
> before I spent a lot of time trying to do something that was not possible.
> 
> Virtual environments tend to confuse me. My system is Mint 18.1 with
> 2.7.12 & 3.5.2 installed. So I would have to download a tar file of 3.6,
> then build it and then use it's version of venv to create a virtual
> environment to try 3.6. Is that correct?
> 
> Thanks,  Jim

It doesn't need to be terribly complicated, something called pyenv can
manage the install for you (yes, it will build it if needed).

pyenv install --list

to show what's available to install

pyenv install 3.6.0

to install a copy

If you set up the shell helpers, pyenv will let you create the
virtualenv and launch it:

pyenv virtualenv 3.6.0 test-3.6.0
pyenv activate test-3.6.0



More information about the Tutor mailing list