Reputation: 1509
I have some noob level virtual environment questions. I've been using virtual environments a little but still have a few questions.
I have created and activated an env which is my main working environment as follows:
virtualenv env
source /path/to/environment/env/bin/activate
Having activated this, I can now see I am in the environment as I have (env)
visible on command line.
My first question is, do I need to run the activate command each time I open a terminal session? And therefore each time I turn my laptop on, etc.?
Further, I want to create another environment that runs on an earlier version of python for testing purposes. I was intending to do it as follows:
virtualenv --python=python2.7 env-py2
source /path/to/new/environment/env-py2/bin/activate
Can these virtualenvs be switched easily? So can I activate env-py2
and then easily jump back to activate env
again? Or is there an inbetween step required?
Apologies for the very basic questions but I was struggling to find high level information.
Upvotes: 9
Views: 41019
Reputation: 651
Yes you need to run activate command i.e. source
each time you open a terminal session.
Switching between two virtual environment is easy. You can run deactivate
command and source the other virtual environment.
Upvotes: 10