Python installation on Windows

31 views
Skip to first unread message

Victor Neo

unread,
Aug 14, 2011, 1:18:39 PM8/14/11
to lad...@googlegroups.com
This thread aims to help Windows users to install Python on their laptops before attending the first LadyPy session.

Requirements:
  1. Windows laptop
  2. Internet Connection
  3. Administrator Rights (for Windows Vista, 7 and above)
Steps:
  1. Download the latest Windows Python installer from http://www.python.org/download/ .
    • As of August 15th 2011, ladypy is using the Python 2.X version instead of the Python 3.X version due to incompatibilities with certain Python applications. Please download the correct version as stated in the email sent by Calvin as part of Assignment 0.
    • Get the one that says 'Windows binary - does not include source'
  2. Once the file is downloaded, double click on it to run the installer. During the process you may be required to grant Administrator permission to install Python - please allow it to do so.
  3. Choose 'Install for all Users' and hit the 'Next' button.
    • Advanced users may prefer otherwise. I will not cover the other options.
  4. A 'Select Destination' screen will be shown; this is where Python will be installed. Hit the 'Next' button. Remember where it is installed - you will need it towards the end.
    • By default 'C:\Python27' (for Python version 2.7) will be chosen. Please take note of this directory and do not modify it. Advanced users may choose another directory but there should be no spaces in the directory name or stability may be compromised.
  5. You will be presented with a 'Customize Python 2.X.X' screen. Leave it alone simply hit the 'Next' button.
  6. Python will now be installed. Let it do it's job :)
  7. Once the installer is done, hit the 'Done' button. However, there is still a critical step to go before your installation is complete.
  8. Click on Windows' Start Button and Right Click on 'My Computer' (you may right click the 'My Computer' icon on the Desktop if it is there). Choose 'Properties' from the list of items.
  9. On the 'Properties' window there will be multiple tabs above - choose 'Advanced'.
  10. Near the bottom of the window you will see the 'Environment Variables' button, click on it.
  11. Now you will see a screen similar to the one in this screenshot. Notice the 'Path' variable highlighted under 'System Variables'. Click on it and then click on the 'Edit' button.
  12. This step is very crucial - remember where you installed Python? It's most probably 'C:\Python27'. In the new window, click on the textbox for 'Variable Value' and scroll all the way to the right. Now, add a semi-colon if there isn't any (skip if there is already one). Add the following: 'C:\Python27;C:\Python27\Scripts' without the single quotes.
    • Note: C:\Python27 is the default directory for Python 2.7, if it differs during your installation please use the one you saw during installation.
  13. You are done! Click on the Ok buttons in all the windows open.

You can now test whether Python is working by testing it on the Command Prompt. To access your command prompt (you will need it a lot for the ladypy lessons), hit the Windows' Start Button and search for 'cmd' without the single quotes for Windows Vista and 7. For Windows XP, hit the StartButton followed by the Run button and type 'cmd' before pressing enter.

A black Command Prompt will now appear before you - get used to it! Type 'python' without the quotes and hit enter - you should see something similar to the following:

Python 2.7.2 (etc etc)
Type "help", "copyright", "credits" or "license" for more information.

Whew, your installation was successful! You may now close the Command Prompt!

Problems? Ask away in this thread! Be sure to say which step you are at and what is the error so that fellow participants or facilitators can help!

Jiang Fung Wong

unread,
Aug 16, 2011, 9:56:34 AM8/16/11
to lad...@googlegroups.com
The next step is to install Django. First we need a tool called pip, which is the current best package installer for Python. It makes installation of packages (i.e. software written in Python language) as easy as running a single command. To install pip, we need something called setuptools.

Go to

And download (assuming you have installed Python 2.7)
setuptools-0.6c11.win32-py2.7.exe

Run the installer, click Next a few times. (make sure you see C:\Python27)

After the installation of setuptools, open a command prompt window (type cmd in Run and Enter)

Enter the following command in sequence:

easy_install pip  [Enter]
pip install django   [Enter]
pip install south   [Enter]

Note: Before you do this you need to set the environment variable as described in the previous guide!
You should see the following output:

C:\Users\kakarukeys>easy_install pip
Searching for pip
Best match: pip 1.0.2
ec6ff3f6d962696fe08d4c8264ad49
Processing pip-1.0.2.tar.gz
Running pip-1.0.2\setup.py -q bdist_egg --dist-dir c:\users\kakaru~1\appdata\loc
al\temp\easy_install-da3jmm\pip-1.0.2\egg-dist-tmp-g1xafu
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'do
cs\_build'
no previously-included directories found matching 'docs\_build\_sources'
Adding pip 1.0.2 to easy-install.pth file
Installing pip-script.py script to C:\Python27\Scripts
Installing pip.exe script to C:\Python27\Scripts
Installing pip.exe.manifest script to C:\Python27\Scripts
Installing pip-2.7-script.py script to C:\Python27\Scripts
Installing pip-2.7.exe script to C:\Python27\Scripts
Installing pip-2.7.exe.manifest script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\pip-1.0.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

C:\Users\kakarukeys>pip install django
Downloading/unpacking django
  Real name of requirement django is Django
  Downloading Django-1.3.tar.gz (6.5Mb): 6.5Mb downloaded
  Running setup.py egg_info for package django

Installing collected packages: django
  Running setup.py install for django

Successfully installed django
Cleaning up...

C:\Users\kakarukeys>pip install south
Downloading/unpacking south
  Real name of requirement south is South
  Downloading South-0.7.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package south

Installing collected packages: south
  Running setup.py install for south

Successfully installed south
Cleaning up...

To test that your Django is installed properly, open a python shell, and perform the following to print the version of Django.

C:\Users\kakarukeys>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> dir(django)
['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_
_path__', 'get_version']
>>> django.VERSION
(1, 3, 0, 'final', 0)
>>>

You have successfully installed Django 1.3 final.

You can install other packages in the same way, for example virtualenv, ipython, fabric, which you will come to know in future.
For now, Django and South are essential for the workshop.

Calvin Cheng

unread,
Aug 16, 2011, 10:25:03 AM8/16/11
to lad...@googlegroups.com
South's not introduced at the moment.
Reply all
Reply to author
Forward
0 new messages