Forums

Problem activating my virtual environment

Hi there,

I am encountering difficulties activating my virtual environment via Bash console. I have tried workon 'my-environment-name' but to no avail.

I am able to access the virtual environment via the web tab but it would be great to access it through the console directly.

I'm very puzzled so would appreciate any help! thanks

workon would only work if you are using virtualenvwrapper (ie. you created your virtualenv using the command mkvirtualenv)

if you are not using virtualenvwrapper, you need to manually go into the virtualenv and run the bin/activate script

Thanks for getting back to me so quickly, Conrad.

I do not know how to manually run the script. I'm quite new to Python so apologies if this is straightforward or signposted somewhere already. Can you provide any guidance?

Cheers!

oh wait- are you using a bash console? Or are you trying to save and run it from the file editor? From the bash console, you want to find where your bin/activate script is and run it from there (it's wherever you have your virtualenv folder). If you are trying to use the save and run function, you should add hashbangs pointing to the correct python path at the top of your python file. (for example you can get this by doing which python from within your virtualenv environment)