“ImportError: No module named site” on Windows

I am trying to install Python for the first time. I downloaded the following installer from the Python website: Python 2.7.1 Windows Installer (Windows binary — does not include source). I then ran the installer, selected ‘All Users’ and all was fine. I installed Python into the default location:

C:\Python27

Next, to test that Python was installed correctly, I navigated to my Python directory, and executed python in the windows CMD prompt. It returns me the following error:

ImportError: No module named site

When I execute python -v I get the following:

#installing zipimport hook
import zipimport # builtin
#installed zipimport hook
#ImportError: No module named site
#clear builtin._
#clear sys.path
#clear sys.argv
#clear sys.ps1
#clear sys.ps2
#clear sys.exitfunc
#clear sys.exc_type
#clear sys.exc_value
#clear sys.exc_traceback
#clear sys.last_type
#clear sys.last_value
#clear sys.last_traceback
#clear sys.path_hooks
#clear sys.path_importer_cache
#clear sys.meta_path
#clear sys.flags
#clear sys.float_info
#restore sys.stdin
#restore sys.stdout
#restore sys.stderr
#cleanup main
#cleanup [1] zipimport
#cleanup [1] signal
#cleanup [1] exceptions
#cleanup [1] _warnings
#cleanup sys
#cleanup builtin
#cleanup ints: 6 unfreed ints
#cleanup floats

When I do dir C:\Python27\Lib\site.py* I get the following:

 Directory of C:\Python27\Lib  

13/11/2010  20:08            20,389  site.py  
               1 File(s)         20,389 bytes  
               0 Dir(s)     694,910,976 bytes free  

Any ideas?

Leave a Comment