title: How to set a environment variable with virtualenv?
body: <p>I'm trying to set up an external program / lib written in python - on debian squeeze.</p>
  
  <p>The error I get when I try to launch it that the "environment variable is not set" - it's an exception throw by the developer. So I guess, I have to define it, but where ?</p>
  
  <ol>
  <li>I've thought virtualenv and path were the same, so I've written a .pth loaded at the launch. It solved some mistake but not all.</li>
  <li>I've read use export in <code>~/.bashrc</code> but I'm not sure it is read in a virtualenv, and I don't want those export be read even when I don't use this virtualenv. </li>
  <li>I've read too to use export in <code>virtualenv/bin/activate</code>, but it doesn't seem to work correctly.</li>
  </ol>
  
  <p>I'm trying to install <a href="http://www.urbansim.org/Download/LinuxInstallation" rel="noreferrer">Opus and Urbansim</a>.</p>
  
  <p>Here is what I get when launching:</p>
  
  <pre><code>(opus-env)touki@touki:~/Projects/opus-env$ ./src/opus_gui/opus.py  
  Traceback (most recent call last):
    File "./src/opus_gui/opus.py", line 14, in &lt;module&gt;
      from opus_gui.main.controllers.opus_gui_configuration import OpusGuiConfiguration  
    File "/home/touki/Projects/opus-test/src/opus_gui/main/controllers/opus_gui_configuration.py", line 12, in &lt;module&gt;
      from opus_core import paths  
    File "/home/touki/Projects/opus-test/src/opus_core/paths.py", line 44, in &lt;module&gt;
      OPUS_HOME = _safe_getenv('OPUS_HOME', _get_default_opus_home)  
    File "/home/touki/Projects/opus-test/src/opus_core/paths.py", line 33, in _safe_getenv
      return os.environ[key] if key in os.environ else default_func()  
    File "/home/touki/Projects/opus-test/src/opus_core/paths.py", line 36, in _get_default_opus_home  
      raise Exception('OPUS_HOME environment variable must be set.') 
  Exception: OPUS_HOME environment variable must be set.
  </code></pre>
  
  <p>NB.: I've searched, autoenv combine virtualenvwrapper seems to provide an answer, but I would prefer not use external programs.</p>