Saturday 22 November 2014

Getting started with Python

There are a lot of IDEs out there for developing standard (fancy) code in python. You can always follow the clearly listed out steps on their respective websites and get your favorite one set up. But hey! you are just getting started, and if you an impatient freak like myself, then you may not want to spend two hours just to install a fancy IDE and write your first "Hello World!" code. Let us do it the quick way first and then we can jump in to more serious stuff. [Pycharm 4 just got released. Yay!]

The fastest way is to get hands on something that will let you write and execute simple one line python code. IPython notebook is an obvious choice for such purposes. Below are the steps to install IPython on your windows machine:

Step 1. Get Python

Got to https://www.python.org/downloads/ and get Python 2.7.8


You may wonder why 2.7.8 and not 3.4.2. Python is currently being supported both in the legacy 2.x.x versions and the new 3.x.x versions. Here are a few reasons to still go with 2.x.x :

  • All the ready made linux distributions still have 2.x.x on them
  • More help available via documentation, blogs and stack overflow
  • And the most important one, you are a beginner and it doesn't matter! :P 

Step 2. Install setup tools


Get the installation script from https://bootstrap.pypa.io/ez_setup.py

Just run the "ez_setup.py" by double clicking on the downloaded ez_setup.py file
You shall see a window pop up like this:


Step 3. Install IPython

In command prompt type :
  •  cmd> C:\Python27\Scripts\easy_install  tornado 
  • cmd> C:\Python27\Scripts\easy_install  pyzmq
  • cmd> C:\Python27\Scripts\easy_install  jinja2
  • cmd> C:\Python27\Scripts\easy_install  ipython



Step 4. Run IPython 
  • cmd> C:\Python27\Scripts\ipython.exe notebook
  • The NotebookApp shall get started in your default web browser
  • Click on add notebook
  • Type: print "Hello World!"
  • Press Shit+Enter


                                                   


No comments :

Post a Comment