So I am interested in learning to code in python. I started with html and css which requires no set up just using gedit to write my code and testing on chromium. I was recently told to learn to do more with html and css. I would need to get a setup for java and start learning some of that.

However I am more interested in learning python. So far all I know Ubuntu 12.10 comes with a version of python. I need to know what would it take to get things set up to the point I can actually open python 3.3.0 on Ubuntu 12.10 and starting trying out commands?

  • 5
    Neto everything is already there. Type python in command line and you can start typing commands to try them out. – Rinzwind Feb 19 '13 at 12:19
  • sudo apt-get install ipython – wim Feb 20 '13 at 0:47
  • You know, Code Academy's Python course isn't too bad. It's completely suitable for complete beginners. It also uses Python 2, so you can supplement with other tutorials you may find on the Interwebs. Python is really fun to learn, it also feels somewhat like JavaScript when you're coding it, so moving from HTML to Python is kind of interesting. – JamesTheAwesomeDude Feb 26 '13 at 13:57

I'm not sure the suggested duplicate quite applies at the moment. Fact is you don't need to set up virtualenv environments or follow best practices to get up off the ground and personally, I think trying to do so will scare you off Python, which is a beautiful language and a very powerful community of tools.

To get a brief glimpse at Python, you can just run python in a terminal and you're dumped into a live python environment. You can play around with code examples to your heart's content.

For bigger things (or when you get fed up of the interactive python console's limitations) you can write Python scripts very easily. Write a file in Python syntax, and then just run python filename and it'll run. Simples.

If you really want to learn Python, I seriously recommend two things:

  • http://learnpythonthehardway.org/book/ - It sounds tough but it's not. The setup section for Linux has a really practical way of getting gedit up to speed too, so don't miss that out.

  • The O'Reilly Python Pocket Reference - This probably only applies if you have experience with other programming languages. I was forever trying to work out how dicts and tuples differed from other languages' arrays and the pocket reference is great for looking it up quickly. Better than Google in my experience. Again, if you don't know what an array is, this might not be much help for you.

Once you advance to projects where you might need best practices, that's the time to start looking at virtualenv (mostly server deployment stuff) or frameworks or anything like that.

Most importantly: have fun.

A note of warning on Python 3.x

A couple of people are suggesting installing (if you need to) and using Python 3. I disagree with this stance. As the asker of the question you're probably completely unaware of the differences between the two or even that there were two versions. That's not your fault - that's just what being a beginner is all about.

Python 3.x has been around for years already but everybody still uses 2.x. I'm serious. Other people may suggest that Py3k is "good enough to learn on" but I posit that at least 90% of all the good tutorials and documentation out there is for Python 2 and trying to follow it in Python 3 will result in tears.

And as you progress and want to pull in external libraries (the really fun bit in Python!) you're going to find that only a tiny slither of the community have migrated over. Inevitably the thing you want to use hasn't been ported and you're left in a pool of your own tears again.

So I know it's 2013 and we're all half-robots floating in space, but take some advice from a cranky Python developer: stick with the old stuff for now. Things for Py3k will improve and probably within the next couple of years it'll be safe to use...

... by which time Python 4 will be released. C'est la vie.

|improve this answer|||||
  • 4
    Why such a scary disclaimer? Learning python 3 is a noble objective. The OP is interested in webdevelopment (I deduct from his mentioning html and css) and big libraries like django will soon be python 3 compatible. Sure there are more libs for 2.7, and yes I prefer 2.7, but nonetheless I think the note of warning is a bit heavy. – don.joey Feb 19 '13 at 14:25
  • 3
    @Private Because it's just a needless complication for very little gain. We're talking about a brand new user. If when I started Python knew that I had to check Py3k compatibility in any library or tutorial before I started, I'd have just run off to Ruby and Rails. Python 2.x is still the default in most places for a reason. – Oli Feb 19 '13 at 15:22
  • And yes, it's deliberately scary because people suggest Py3k to people who know nothing about it without explaining the pitfalls. There are issues using it. The only thing you need to mention about Python 2 is the kooky way it handles division (and all the docs show have massive sections on this). – Oli Feb 19 '13 at 15:24
  • 1
    So, why is it that the default Python in Ubuntu 12.10 is 3.3? Just because the majority of existing developers still use 2.x is no reason for fresh blood not to think ahead and start their Python career with 3.x. And the situation with un-ported libraries is not so bad, either. Python 3 is so much nicer to work with these days, even than only a few months ago. I have to agree that good tutorials for Python 3 are few and far between, but I have found it very instructive in my learning to code and compare both 2.7 and 3.2, and this has convinced me that Python 3.x is the way to go. – Bobble Feb 19 '13 at 20:28
  • 1
    @Bobble The Python default for 12.10 is 2.7.3, not 3.3. 3.2 is included but what you get when you run python is 2.7.3. I agree that 3.x is the future I just don't think it's something you need to get involved in from the very beginning. Starting on 2.7 gives you advantages without being a problem. – Oli Feb 22 '13 at 12:54


To just start playing with python just type python or python3 in a terminal. The first starts python 2, the latter starts python 3. There are two major versions of python (namely 2 and 3) and they differ from each other. In fact, the python developers decided to thoroughly review a number of things in python 3. On a fresh 12.10 install, you normally of both already installed. You'll see something like this (for python 2):

Python 2.7.3 (default, Apr 10 2012, 23:31:26)
Type "copyright", "credits" or "license()" for more information.

Then you can do things like:

1 + 2


a = 1
b = 4
a + b

or write functions

def multiply(a,b):
    return a * b

and use them


You can save these functions and calculations in a file. Usually you name them someName.py. You can then make that file executable by typing chmod 700 someName.py or you can play with the file in an IDE (see below). If the file is executable you can run python someName.py to run the file with python 2 or python3 someName.py to run it with python 3.

Integrated Development Environments

To start learning python, the easiest way is to start with what is called an IDE, that is an integrated development environment. Don't worry about all the ways in which you can use an IDE. IDE's allow you to save commands in a file and excute them easily.

You can install IDLE (sudo apt-get install idle), which is the default python IDE. Or you can use geany, reinteract, gedit or whatever.

What an IDE does is really help you to manage your files and your commands.

One of the best places to start is the official python tutorial for python 2 or python 3, I think.


|improve this answer|||||
  • Another (very nice) IDE for Python is Ninja IDE. To install: sudo add-apt-repository ppa:ninja-ide-developers/ninja-ide-stable && sudo apt-get update && sudo apt-get install ninja-ide. – sierrasdetandil Feb 23 '13 at 19:52


If you want to get acquainted to python using the interactive python interpreter, I'd suggest installing bpython, which is an extension of the stock python interpreter. It offers the following features (taken from its website):

  • In-line syntax highlighting.
  • Readline-like autocomplete with suggestions displayed as you type.
  • Expected parameter list for any Python function.
  • "Rewind" function to pop the last line of code from memory and re-evaluate.
  • Send the code you've entered off to a pastebin.
  • Save the code you've entered to a file.
  • Auto-indentation.
  • Python 3 support.


sudo apt-get install bpython

Run it:


As for Python 2 vs. 3:

Ubuntu includes version 2.7, which is the last iteration of the 2.xx branch and includes many features of python 3. I'd say stick to python 2 (mostly because of the vast amount of libraries not ported to python 3 yet), but if you run scripts, use the -3 switch to be aware of the problems that could arise if you ran the script on python 3. E.g.: python2 -3 script.py

There is a nice website where you can see differences between the major python versions: http://docs.pythonsprints.com/python3_porting/py-porting.html

|improve this answer|||||

One more point to note is that default python version on Ubuntu is Python 2.7.x and not Python 3. However you can install Python 3 by running this command:

sudo apt-get install python3  

To start it in interactive mode, just run python3.

|improve this answer|||||
  • 2
    if the OP is on 12.10 then python3 is already installed, right? – don.joey Feb 19 '13 at 12:55

You might want to check out coursera.org they have many online courses, including a python one starting soon. kahnacademy also has python lectures. python.org has nice tutorials also... Scott

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.