Why I am getting error when I am trying to use virtualenvwrapper.
Matthew Barrera
I have installed virtualenv using pip command:
$ pip install --user virtualenvand virtualenwrapper
$ pip install --user virtualenvwrappereverything worked fine:
$ pip show virtualenvwrapper
Name: virtualenvwrapper
Version: 4.3.2
Location: /home/mukesh/.local/lib/python2.7/site-packages
Requires: virtualenv, virtualenv-clone, stevedoreI made two directories ".virtenvs" and "Project-Active". I am doing this by following a blog post. Then I have changed my .bashrc file by adding following lines:
export WORKON_HOME=$HOME/.virtenvs
export PROJECT_HOME=$HOME/Projects-Active
source $HOME/.local/bin/virtualenvwrapper.shAfter saving the changes, I sourced the file to make the changes active:
$ source ~/.bashrcWhen I am trying to make a new virtual environment by using following command:
$ mkvirtualenv test_env01I am getting error:
ERROR: virtualenvwrapper could not find virtualenv in your pathDon't know what should I do now.
4 Answers
I tried to follow the tutorial as well, but it still fails, then had to do it another way:
# pip install virtualenv
# pip install virtualenvwrapperAfter doing so, which command worked indicating where the executable is:
which virtualenvwrapper.sh
/usr/local/bin/virtualenvwrapper.shAs I understand it in a publication, the virtualenv must be installed via sudo without the --user option.
I could solve the problem by installing virtualenv via apt-get
sudo apt-get install virtualenvI really don't know the consequences of this, but so far it works for me
DO the two steps:
1) sudo find / -name "virtualenv"
Then I find the executable file, the path is:
/usr/local/Cellar/python/2.7.12/Frameworks/2) Touch a soft link in the or add the path to the .bash_profile, I prefer the former:
sudo ln -s /usr/local/Cellar/python/2.7.12/Frameworks/ /usr/local/bin/virtualenv From my experience, following the instructions on some sites will land you in problem. Here's how i did it but first the common mistakes:
pip install virtualenv
pip install virtualenvwrapper
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.shnow that's not gonna work for you especially now with 16.04 comes with virtualenv as one of her packages. Some pitfalls is now trying to uninstall it with:
sudo pip uninstall virtualenvwhen you never installed it with admin rights. Instead do:
pip uninstall virtualenvthen now install it with the Ubuntu repo (recommended) using:
sudo apt-get install virtualenv
sudo apt install virtualenvwrappervirtualwrapper (user friendly wrappers for the functionality of virtualenv)The reason we are also installing virtualwrapper is because it offers nice and simple commands to manage your virtual environments.
echo "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh" >> ~/.bashrcSource virtualenvwrapper in .bashrc
or
open your .bashrc file and add:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/PyProj
source /usr/share/virtualenvwrapper/virtualenvwrapper.shthis will set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package.
now run workonif this is your first time it won't show anything, don't panic. If not, a list of environments, empty, is printed.
run mkvirtualenv tempnew environment, temp is created and activated.
then run workon again
This time, the temp environment is included.
Now have fun