Tag Archives: Visual Studio

Install Python From the Source Code

Python logo

Image via Wikipedia

Installing Python in Windows 7 is simple, because a pre-built  Windows installer exists. The problem begins when you are trying to compile another Python based libraries, which are asking for e.g. python27_d.lib file. This file is absent, thus you have to build the Python source files from scratch. Python distribution includes SLN files for Visual Studio, but if you try to run them, you’ll get errors. The official explanations of the installation process in Windows … well, I can’t understand from there what to do with the errors.

Still, there is a simple enough solution:

  1. Install VS2008. This will not work for other versions.
  2. Install the Netwide Assembler: www.nasm.us , click on “DOWNLOAD” link, choose the latest stable version directory (not rc), click on “win32” directory, download and run the installer (e.g., http://www.nasm.us/pub/nasm/releasebuilds/2.09.10/win32/nasm-2.09.10-installer.exe). The program should be installed to C:\Program Files\NASM.
  3. Go to C:\Program Files\NASM\ and  rename the file nasm.exe to nasmw.exe.
  4. Install Cygwin from cygwin.com: Choose all default settings, except the addition of the following packages:
    1. curl
    2. cvs
    3. git
    4. subversion
    5. tcltk
    6. unzip
    7. zip
  5. Add to the PATH the directories C:\Program Files\NASM\ and C:\cygwin\bin: go to Control Panel, start searching for env…and choose “Edit the system environment variables” –>Environment Variables…–>Edit PATH variable.
  6. Download the Python source code from python.org site: e.g.  http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
  7. Create directory: C:\Python27 and copy all the source files and sub-directories there. If everything is okay, you should see the directory C:\Python27\PCbuild.
  8. Run cmd as administrator: Start button–>All Programs–>Accessories–>Right click on Command Prompt–>Run as Administrator.
  9. In the open terminal write the following:
    1. cd C:\Python27
    2. .\tools\buildbot\build
  10. The Debug version of Python should be installed without errors.