title: How to create a virtual environment for a specific version of Python?
body: <p>I am using a Macbook. It came with python 2.7.6 installed. I manually installed python 3.4. I develop websites using django. I have only used python 3 and when I work on a project, I simply put it inside a virtual environment. </p>
  
  <p>For instance, I have a project using django-1.8 and python-3.4. I used the following command to create the environment:</p>
  
  <pre><code>python3 -m venv myvenv
  </code></pre>
  
  <p>After that I installed django and other packages inside of this environment.</p>
  
  <p>However, I want to work on another project using python 2.7. <strong>How do I create an environment for python 2.7</strong> and install packages inside of that, so that my other projects remain separate and workable at the same time?</p>
  
  <p>Also, is this the best way to do things? Am I going to mess something up if I continue like this?</p>
  
  <p><strong>Edit:</strong> I tried a solution from another question. I ran the following command on the terminal:</p>
  
  <pre><code>virtualenv -p /usr/bin/python2.7 &lt;path/to/new/virtualenv/&gt;
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>-bash:syntax error near unexpected token 'newline'
  </code></pre>
  
  <p>Also, I tried installing virtualenv using pip running this command:</p>
  
  <pre><code>pip install virtualenv
  </code></pre>
  
  <p>It says pip is not found which is weird as I have used pip countless times before inside my virtual environments. Am I making a stupid mistake? </p>