title: running a virtualenv python under Xcode
body: <p>So far I've been able to work with Python 3 and Xcode 5.1.1 by editing the scheme, pointing the Run executable to python3 and then adding some arguments as in the following picture:</p>
  
  <p><img src="https://i.stack.imgur.com/Rpm07.png" alt="enter image description here"></p>
  
  <p>But now I would like to work with isolated Python environments through <code>virtualenv</code>. I can do this through the terminal, as I just have to type <code>workon pydev</code> where <code>pydev</code> is my Python environment. But I have no idea of how to modify my Xcode configuration so that I can run within a Python environment. Is there an environmental variable or something I can set to make this happen?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>So I have a partial answer but I still can't make it work on Xcode. I created a simple bash script:</p>
  
  <pre><code>#!/usr/bin/env bash
  
  source ~/.bash_profile
  workon pydev
  python3 src/__main__.py
  </code></pre>
  
  <p>The source is needed because otherwise the <code>workon</code> command doesn't work (another file provided by the <code>virtualenv</code> package is sourced inside <code>.bash_profile</code>. I can run the script in the Terminal, but the problem now is that Xcode doesn't like it:</p>
  
  <blockquote>
    <p>Xcode cannot run using the selected destination.
    Choose a destination with a supported architecture in order to run on this system.</p>
  </blockquote>