Wednesday, April 10, 2013

Installing Django Framework using pip

The recommended way to install Django is with pip. pip is a tool for installing and managing Python packages.
Before installing Django, you need to install pip!


1. Install python
First things first – get Python! You can get the Python 2.7.3 (the current Python 2.x version as of this writing) 32-bit installer from http://python.org/download/.
C:\>python
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Type quit() to close the python interpreter
>>>
>>> quit()

NB: Before punning the command, remember to add the python on the windows environment PATH

2. Install Distribute. Distribute is a pre-requisite for pip
Download the distribute_setup.py file to you computer. Click on the file to install Distribute, or run from the command prompt.
C:\>python distribute_setup.py
Extracting in c:\users\amache~1\appdata\local\temp\tmpbjtb6b
Now working in c:\users\amache~1\appdata\local\temp\tmpbjtb6b\distribute-0.6.36
Installing Distribute
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at c:\python27\lib\site-packages
Non-egg installation
Moving elements out of the way...
Already patched.
..
Installed c:\python27\lib\site-packages\distribute-0.6.36-py2.7.egg
Processing dependencies for distribute==0.6.36
Finished processing dependencies for distribute==0.6.36
After install bootstrap.
C:\Python27\Lib\site-packages\setuptools-0.6c11-py2.7.egg-info already exists

3. Install pip
Now, Download the pip install script from GitHub.
Install by clicking the script or running from python command prompt

C:\>python get-pip.py
Downloading/unpacking pip
  Downloading pip-1.3.1.tar.gz (247Kb): 247Kb downloaded
  Running setup.py egg_info for package pip

    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.txt' found under directory
 'docs\_build'
    no previously-included directories found matching 'docs\_build\_sources'
Installing collected packages: pip
  Running setup.py install for pip

    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.txt' found under directory
 'docs\_build'
    no previously-included directories found matching 'docs\_build\_sources'
    Installing pip-script.py script to C:\Python27\Scripts
    Installing pip.exe 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
Successfully installed pip
Cleaning up...

Test the installation
C:\>pip

Usage:
  pip <command> [options]


4. Install virtualenv (Not Compulsory, but very advised)
C:\>pip install virtualenv
  Install virtualenvwrapper  (for microsoft Windows)
C:\>pip install virtualenvwrapper-win

And you are good to go!!

Thanks to tyler butler for his informative procedure

No comments: