title: virtualenv on windows 7 returns AssertionError
body: <p>Having trouble with virtualenv on Windows 7.</p>
  
  <p>I run:</p>
  
  <pre><code>virtualenv _testenv
  </code></pre>
  
  <p>It returns:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python27\Scripts\virtualenv-script.py", line 9, in &lt;module&gt;
      load_entry_point('virtualenv==1.5.2', 'console_scripts', 'virtualenv')()
    File "C:\Python27\lib\site-packages\virtualenv.py", line 558, in main
      prompt=options.prompt)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 647, in create_environment
      site_packages=site_packages, clear=clear))
    File "C:\Python27\lib\site-packages\virtualenv.py", line 771, in install_python
      copy_required_modules(home_dir)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 725, in copy_required_modules
      dst_filename = change_prefix(filename, dst_prefix)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 710, in change_prefix
      (filename, prefixes)
  AssertionError: Filename c:\Python27\Lib\os.py does not start with any of these prefixes: ['C:\\Python27']
  </code></pre>
  
  <p>I have the following environment variables:</p>
  
  <pre><code>PYTHONHOME=C:\Python27
  PYTHONPATH=c:\Python27;c:\Python27\Lib
  PYTHONSTARTUP=C:\Users\Larry\.pythonrc
  PATH=%PYTHONHOME%\;%PYTHONHOME%\Scripts;etc
  </code></pre>
  
  <p>Installed ActiveState Python:</p>
  
  <pre><code>ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
  Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)] on win32
  </code></pre>
  
  <hr>
  
  <p>I updated the PYTHONPATH=C:\Python27;C:\Python27\Lib
  Still looking for a solution, I found and removed AppData/Python*. Reinstalled Python and now have a different error:</p>
  
  <pre><code>C:\xbz&gt;virtualenv _t
  PYTHONHOME is set.  You *must* activate the virtualenv before using it
  Overwriting _t\Lib\site.py with new content
  New python executable in _t\Scripts\python2.7.exe
  Not overwriting existing python script _t\Scripts\python.exe (you must use _t\Scripts\python2.7.exe)
  Overwriting _t\Lib\distutils\__init__.py with new content
  Installing setuptools..............
    Complete output from command C:\xbz\_t\Scripts\python2.7.exe -c "#!python
  \"\"\"Bootstrap setuptoo...
  
  
  " --always-copy -U setuptools:
    Traceback (most recent call last):
    File "&lt;string&gt;", line 278, in &lt;module&gt;
    File "&lt;string&gt;", line 210, in main
    File "&lt;string&gt;", line 132, in download_setuptools
    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: No module named _socket
  ----------------------------------------
  ...Installing setuptools...done.
  Traceback (most recent call last):
    File "C:\Python27\Scripts\virtualenv-script.py", line 9, in &lt;module&gt;
      load_entry_point('virtualenv==1.5.2', 'console_scripts', 'virtualenv')()
    File "C:\Python27\lib\site-packages\virtualenv.py", line 558, in main
      prompt=options.prompt)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 654, in create_environment
      install_setuptools(py_executable, unzip=unzip_setuptools)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 384, in install_setuptools
      _install_req(py_executable, unzip)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 360, in _install_req
      cwd=cwd)
    File "C:\Python27\lib\site-packages\virtualenv.py", line 624, in call_subprocess
      % (cmd_desc, proc.returncode))
  OSError: Command C:\xbz\_t\Scripts\python2.7.exe -c "#!python
  \"\"\"Bootstrap setuptoo...
  
  
  
  
  " --always-copy -U setuptools failed with error code 1
  </code></pre>
  
  <hr>
  
  <p>I hacked Lib/socket.py and inserted:</p>
  
  <pre><code>import sys
  sys.path = ['', 'C:\\Python27\\lib\\site-packages\\dotcloud-0.3.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\dotcloud.cli-0.3.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\flask-0.7dev_20110622-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\werkzeug-0.6.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\gunicorn-0.12.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\wtforms-0.6.3-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\repoze.browserid-0.3-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\paste-1.7.5.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\django_pjax-1.0-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\paramiko-1.7.7.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pycrypto-2.4.1-py2.7-win32.egg', 'C:\\Python27', 'C:\\Python27\\Lib', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\PIL', 'C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info', 'C:\\Python27\\Scripts', 'C:\\Python27\\Lib\\site-packages\\django\\bin']
  </code></pre>
  
  <p>Above</p>
  
  <pre><code>import _socket
  </code></pre>
  
  <p>The reason was that I was able to import socket from straight python prompt! So stuffed my existing path. I haven't narrowed down exactly which directory made it happy. It at least will reveal to someone else why I am getting the error without it.</p>
  
  <p>Ideas? Suggestions?
  Thank you. :)</p>
  
  <hr>
  
  <p>I hacked Lib/socket.py and inserted:</p>
  
  <pre><code>import sys
  sys.path.append('C:\\Python27\\DLLs')
  </code></pre>
  
  <p>Above</p>
  
  <pre><code>import _socket
  </code></pre>