title: How to create a virtual environment for python 2.7.x?
body: <p>I have 3 versions of python installed on my mac-OSX. Python 2.7.6 came pre-installed with the machine. I installed python 3.4.3 before. Now I installed python 2.7.11 by downloading the pkg file from the website. I also installed pip and virtualenv. </p>
  
  <pre><code>$python
  </code></pre>
  
  <p>If I run the above command on my terminal, the following is returned:</p>
  
  <pre><code>Python 2.7.11(...)...
  .........
  &gt;&gt;&gt;
  </code></pre>
  
  <p>indicating that the latest version of python is working.</p>
  
  <p>However, I created a virtual environment using virtualenv using the following command:</p>
  
  <pre><code>$virtualenv -p /usr/bin/python2.7 venv
  </code></pre>
  
  <p>and activated it using:</p>
  
  <pre><code>$source venv/bin/activate
  </code></pre>
  
  <p>If I now run the python command in the terminal with the virtual environment activated, the following is returned:</p>
  
  <pre><code>Python 2.7.6(...)...
  .........
  &gt;&gt;&gt;
  </code></pre>
  
  <p>What is the problem here? Why isn't the virtual environment using python 2.7.11 and how can I fix this? Thanks.</p>
  
  <p><strong>Edit 1:</strong>
  If I run this command:</p>
  
  <pre><code>$python2.7
  </code></pre>
  
  <p>the following is returned:</p>
  
  <pre><code>python2.7.11(...)...
  ....
  &gt;&gt;&gt;
  </code></pre>
  
  <p><strong>Edit 2:</strong>
  Running this command:</p>
  
  <pre><code>python -c "import os;print os.environ.get('VIRTUALENV_INTERPRETER_RUNNING')"
  </code></pre>
  
  <p>returns None.</p>
  
  <p><strong>Edit 3:</strong>
  I tried specifying which python interpreter to use for venv creation.  My python 2.7.11 is located in a directory called python 2.7 in applications. I ran the following command: </p>
  
  <pre><code>$virtualenv -p /Applications/Python\ 2.7 myvenv 
  </code></pre>
  
  <p>The following error was returned: </p>
  
  <pre><code>OSError: [Errno13] Permission denied. 
  </code></pre>