7

Ok so I have decided to delve into the realms of casual coding and I have been told Python is a great language for beginners like myself. I know (not really sure though) the Python interpreter is included by default in Ubuntu but plan to install the IDLE GUI as my Python GUI. What else do I need to do to make my 12.04 set-up a true Python development environment?

1
  • A quick tip, python IDLE GUI is cool for testing some code snippets.Though its not at all practical to do any serious development on it.Most developer prefer command line. Its more robust and speedy. Jun 21, 2012 at 19:24

7 Answers 7

6

In Ubuntu 12.04 Python 2.7.3 is already pre-installed

Take a look at the Ubuntu Software Center -> Developer Tools -> Python There you can find IDLE or SPE, which are both good development environments. They should work out of the box. There are also Plugins available for Eclipse and Netbeans.

if you want to use the newest version of Python take a look at this website

https://www.python.org/downloads/

1
  • This is fine for the first month to year of learning how to program. Once you start to make actual projects you start running into pain and suffering around separate versions and sets of libraries. So you can dive in with Fritte's above answer, but realize you'll eventually need to learn about how to isolate environments using things like pyenv and virtualenv. You might run into this early on when you get excited to use the shiniest new Python and botch things one way or another such that Ubuntu apps assuming a sane system Python don't work anymore.
    – labyrinth
    Sep 6, 2017 at 16:27
4

There is a good video here on YouTube about how to write a python program for Ubuntu using Quickly. The example shows how to create a quick browser.

It uses whatever editor you have configured, such as gedit or vim.

3

There are a lot of different development evironments. You can simply use the text editor of your choice. Most of them, like the integrated gedit have syntax highlighting. You can then simply run your program with python. There is no need for compiling. You could also use an integrated developer environment (IDE). Those give you a little more support in coding. Take a look at this list. I prefer eclipse with the PyDev plugin.

For starters create a file myProgram.py and open it wiht gedit. Write your program in that file, just google for some tutorials. After the first few lines of code gedit will recognize you're writing python and starts to highlight the syntax. If you're done open a terminal, change to the folder where your program is saved and start it with python myProgram.py. Python is a interpreted language so the code can be executed directly. In some other languages you have to compile your source code first. It then creates an binary file you can execute. But you don't have to bother with that if you use python.

Hope that helps a little, if you want more detailed information just ask :-)

2
  • More details please. The closest I have come to programming is QBASIC :D
    – Mysterio
    Jun 21, 2012 at 17:38
  • I've added some details. Just take another looks if it helps. Jun 21, 2012 at 17:47
2

I tried IDLE but after a bit I found that a better development environment was using Eclipse with the pydev plugin. Eclipse can be gotten using the software center or from apt-get install. The plugin is easy to add by starting Eclipse and going

http://www.eclipse.org/

http://pydev.org/

1

sudo apt-get install python should do it. (although this is usually already installed)

Then you can just create your python code in some folder as .py files, and then do python /path/to/the/python/script.py.

4
  • What about IDLE because I don't want to be coding from the terminal.. Is it really true that Python is noob-friendly ??
    – Mysterio
    Jun 21, 2012 at 17:32
  • its pretty straight forward. I've never used IDLE, i've used Stani's Python Editor, but I dont know if its in the repositories. Dr Python's not a bad IDE either (i think that's still in the repos, but i dont remember what package it is). As for running the python code, I think SPE can do it, idk about DrPython. (I just run it all in Terminal)
    – Thomas Ward
    Jun 21, 2012 at 17:45
  • Does that command automatically install the latest version of Python? What can I do to get 2.x? Jul 31, 2014 at 21:07
  • If 2.x isn't available on the version of Ubuntu you are on you'll have to use either a PPA with an older version or compile the older version yourself. There's no guarantee the IDEs will install a version of Python either so you should always check and install a version to use yourself.
    – Thomas Ward
    Jul 31, 2014 at 21:08
1

Ubuntu has Python installed by default. Python IDLE is good for checking some snippets of code but it is not very good for doing some serious work. I recommend installing ipython for doing some command line exploration.

Well, in order to setup an IDE you could choose between Sublime Text 2(highly recommended) and Vim. You could use my dotfiles for both the editors:

Both of these dotfiles have all the plugins, linters installed and would be excellent place for you to start with. Hope this helps you.

1

You can also use virtualenv, it is a tool to create isolated Python environments. virtualenv creates a folder which contains all the necessary executables to use the packages that a Python project would need.

Install virtualenv via pip:

$ pip install virtualenv

http://docs.python-guide.org/en/latest/dev/virtualenvs/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .