Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activating python virtual environment does not switch to local versions of pip and python commands

I have created a virtual enviroment using virtualenv command with a standard procedure. Now, when I activate it or deactivate, the output of which pip or which python gives me same output /usr/local/bin/pip. However there is copies of python and pip commands in my vitrual enviroment directory - I have found them there. What might be the problem?

like image 541
freude Avatar asked Mar 30 '18 02:03

freude


1 Answers

Did you move the virtual environment folder to a different name? The original path to the virtual environment is written into the generated activate script so if you move the environment activate will set your path to the old path of the virtual environment.

To fix this run virtualenv --relocatable $YOUR_VIRTUALENV_PATH then modify the VIRTUAL_ENV variable in the activate script to point to your new location.

like image 93
mcrute Avatar answered Sep 30 '22 18:09

mcrute