setting up Django Virtual Env error "The executable /var/bin/python (from --python=/var/bin/python) does not exist"
Question: I was given a project to work on and am now trying to run that project in a
virtual environment. I am new to python, but in the past, I was comfortable
with the "manage.py runserver" concept. I'm having trouble learning virtual
environments.

I know that I have virtualenv installed.

My first direction given to run the virtual environment for this project was
to run `virtualenv --python=/var/bin/python --clear --no-site-packages
--unzip-setuptools --setuptools ~/virtualenvs/project_name`

That results in this error:

`The executable /var/bin/python (from --python=/var/bin/python) does not
exist`

I already have python installed, what does this even mean? I am also confused
about this syntax, `--python=/var/bin/python`, was that a relative path that I
should have switched out "python=/" for something else? what does the "=/"
actually represent?

Am I running the command in the wrong folder? I have tried running it in both
the outer project_name folder, containing a subfolder of the same name, and
also, inside that subfolder (which contains the manage.py). However, I can't
find the var/bin/... paths anywhere in either folder. Where should the bin
paths be located?

Any help or insights would be much appreciated, thanks!


Answer: If you are new to virtual environments, these are the steps I would take to
install a virtual environment. I hope this helps.

**Setuptools**

First to check if you already have it installed type the following:

    
    
    python
    >>>import setuptools
    

If you get another >>> then you have it installed, otherwise you'll get an
error. If you happen to blow up setuptools, here's how you reinstall it:

    
    
    http://pypi.python.org/pypi/setuptools 
    

1.Download Python 2.7 egg

2.Change directory into new unzipped folder

3.Run the following command:

    
    
    sudo sh ~/folder/you/downloaded/to/setuptools-0.6c11-py2.7.egg 
    

**Virtialenvwrapper**

    
    
    sudo pip install virtualenvwrapper
    

**Setup**

1.Create your directories

    
    
    sudo mkdir /project_name
    sudo chown -R yourusername:admin /project_name
    

2.Find virtualenvwrapper.sh to use in step 3 below, check the following paths:

    
    
    /Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper.sh 
    /usr/local/bin/virtualenvwrapper.sh
    

3.Update your profile script (~/.bash_profile or ~/.profile) in a text editor,
adding the lines below at the bottom of the file. If you don't have either of
these files in your home directory, create a file named .bash_profile in your
home directory.

    
    
    export WORKON_HOME=$HOME/.virtualenvs
    source /insert/your/path/to/virtualenvwrapper.sh
    

4.Quit your Terminal app and restart it. You should see a bunch of folders get
created when you restart it. This will only happen once.

5.Make your environment

    
    
    mkvirtualenv django
    (django)$ <- now you are in your new virtualenv
    

6.To leave your environment:

    
    
    (django)$ deactivate
    

7.To enter your environment, quit Terminal again to reset paths so we can test
our setup and move into your working directory to checkout a project:

    
    
    workon django
    (django)$ <- you are back in your environment
    

