title: How can I use virtualenv to use 32-bit and 64-bit Python in Windows?
body: <p>I have 64-bit Python (2.7.5) installed at <code>C:\Python27</code> and 32-bit Python at <code>C:\Python27_32</code>.</p>
  
  <p>I would like to use virtualenv to set up a 32-bit virtual environment that I can switch into when I need to use 32-bit Python.  Once that environment is set up, I plan to edit the <code>bin\activate</code> file to change all the necessary paths to point to the 32-bit directories.</p>
  
  <p>However, when I try to create the virtual environment, I get the following error:</p>
  
  <pre><code>&gt; virtualenv --python=C:\Python27_32\python.exe foo
  
  Running virtualenv with interpreter C:\Python27_32\python.exe
  PYTHONHOME is set.  You *must* activate the virtualenv before using it
  New python executable in foo\Scripts\python.exe
  Installing setuptools...............
    Complete output from command C:\Users\&lt;user&gt;\Drop...o\Scripts\python.exe -c "#!python
  \"\"\"Bootstra...sys.argv[1:])
  
  " C:\Python27\lib\site...ols-0.6c11-py2.7.egg:
    Traceback (most recent call last):
    File "&lt;string&gt;", line 278, in &lt;module&gt;
    File "&lt;string&gt;", line 238, in main
    File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 21, in &lt;module&gt;
    File "build/bdist.linux-i686/egg/setuptools/package_index.py", line 2, in &lt;module&gt;
    File "C:\Python27\Lib\urllib2.py", line 94, in &lt;module&gt;
      import httplib
    File "C:\Python27\Lib\httplib.py", line 71, in &lt;module&gt;
      import socket
    File "C:\Python27\Lib\socket.py", line 47, in &lt;module&gt;
      import _socket
  ImportError: DLL load failed: %1 is not a valid Win32 application.
  ----------------------------------------
  ...Installing setuptools...done.
  Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\virtualenv.py", line 2577, in &lt;module&gt;
      main()
    File "C:\Python27\lib\site-packages\virtualenv.py", line 979, in main
      no_pip=options.no_pip)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 1091, in create_environment
      search_dirs=search_dirs, never_download=never_download)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 611, in install_setuptools
      search_dirs=search_dirs, never_download=never_download)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 583, in _install_req
      cwd=cwd)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 1057, in call_subprocess
      % (cmd_desc, proc.returncode))
  OSError: Command C:\Users\&lt;user&gt;\Drop...o\Scripts\python.exe -c "#!python
  \"\"\"Bootstra...sys.argv[1:])
  
  " C:\Python27\lib\site...ols-0.6c11-py2.7.egg failed with error code 1
  </code></pre>
  
  <p>It seems to be doing imports in the 64-bit folder instead of in the 32-bit folder.  I'm not sure if it's because of the way my environment variables are set up, or because I installed virtualenv under 64-bit Python in the first place.</p>
  
  <p>These are my user environment variables:</p>
  
  <pre><code>Path: %PYTHONHOME%;C:\Python27\Scripts
  PYTHONHOME: C:\Python27
  PYTHONPATH: C:\Python27\Lib;C:\Python27\Lib\lib-tk;C:\Python27\DLLs;
  </code></pre>
  
  <p>But if I change every <code>C:\Python27</code> to <code>C:\Python27_32</code> in my environment variables, then I can't virtualenv to run (<code>ImportError: No module named pkg_resources</code>).</p>
  
  <p>This is my first time messing with virtualenv, so I'm sure I'm missing something basic.  How can I create a virtual environment that uses my 32-bit Python installation?</p>