[Tutor] Can a virtual environment be renamed?

Jim jf_byrnes at comcast.net
Mon Apr 17 17:53:39 EDT 2017


On 04/16/2017 11:24 AM, Chris Warrick wrote:
> On 16 April 2017 at 18:16, Jim <jf_byrnes at comcast.net> 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?
>
> Yes, you need to install the appropriate interpreter first, and
> likewise a virtualenv won’t work if you uninstall an
> interpreter/upgrade it to a new minor version*. You might not need to
> use the source tarball if
> https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes works on Mint
> (and if you do use tarballs, make sure to install somewhere in /opt or
> whatever not to make a mess — it’s easy to break your OS if you’re not
> careful)
>
> * eg. 3.5 → 3.6. Won’t ever happen on Mint or other “friendly”
> distros, unless you do a dist-upgrade. Happens pretty often on
> rolling-release distros or macOS with homebrew.
>

Chris, thanks for the confirmation and the link.

Regards, Jim



More information about the Tutor mailing list