Hi,

pyenv (https://github.com/pyenv/pyenv) offers a simpler way for 
activating/deactivating venvs, by managing this automatically for you based on 
where you are located in the file tree.

Before focusing on this feature, you must know that pyenv does far more than 
managing virtualenvs, since it lets you manage also different versions and 
implementations (e.g. CPython, PyPy...) of Python interpreter, whatever is the 
ones installed on your system.

This feature is very useful in several situations, among which :

  *   testing a different Python version than the ones installed, without 
taking any risk of tampering your system or needing for a virtual machine
  *   when targeting containerized applications (in which you are free to 
choose whatever Python version you want/need in the container, without any 
concern about the host environment), being able to work in the exact same 
context as the production one

Of course, you can create virtualenvs as usual with pyenv, for any Python 
version installed under its control.

It also lets you set which Python version or virtualenv must be used in a given 
project or workspace. As soon as you cd in the corresponding file tree, pyenv 
will automatically activate the right virtualenv (and deactivate the active one 
if any) and the associated Python interpreter. It does the reverse (i.e. 
deactivating it) when leaving the tree. The magic is done by storing the Python 
interpreter or virtualenv name in a hidden file (namely .python-version) at the 
root of the related file tree. The pyenv shell plugins look for this file by 
climbing the file tree when you navigate in the dirs and does what it has to do 
accordingly.

What's very important is that pyenv does not touch a bit of your system wide 
Python interpreters, but uses a mechanism of shims to masquerade them and 
redirect the flow to installations located under your home dir.

Even if you don't play with different Python version, IMHO pyenv deserves a 
look, if only for its automatic virtualenv switching capability.

PS: I'm not affiliated in anyway with pyenv creators, but just a happy user for 
a while now 🙂

Best

Eric

________________________________
From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf 
of Gil Obradors <gil.obrad...@gmail.com>
Sent: Saturday, March 30, 2019 19:35
To: django-users@googlegroups.com
Subject: Re: Venv

You do it: source <new>/bin/activate

Missatge de John <johncrosb...@gmail.com<mailto:johncrosb...@gmail.com>> del 
dia ds., 30 de març 2019 a les 19:32:
Good evening

I've created and activated venv like this:
$ python3 -m venv <new>
$ source <new>/bin/activate

Now Ive ‘deactivate’ the venv

How do I re-activate please?

🙏



--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/EA2E8453-8CF9-4F32-9EB6-D364C71D3FD4%40gmail.com<https://groups.google.com/d/msgid/django-users/EA2E8453-8CF9-4F32-9EB6-D364C71D3FD4%40gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK-JoTQ--pE5AKEDwjmv%2BDV_LuxsZ3U22JSmHUFqavR8qEYWGA%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAK-JoTQ--pE5AKEDwjmv%2BDV_LuxsZ3U22JSmHUFqavR8qEYWGA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AM0P193MB0308591E22210F526E0D36B88C560%40AM0P193MB0308.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.

Reply via email to