If you use Windows, you can install Python and start writing your own programs pretty quickly. You shouldn't have too much trouble as you're learning, but at some point you might notice that some of the resources you'd like to use are written for Linux or Mac users. At that point you'll have a number of options, and we'll help you work through those issues when they come up.
Python is not usually installed by default on Windows systems. To find out if it's installed, open a terminal and type the word python
. If you haven't used a terminal before, go to your Start menu and start typing the word 'command'. You'll see an icon for the Windows command console. You can also hold the Shift button while right-clicking the mouse.
Enter the word python
in the terminal, and press Enter. You'll probably get a message that Windows does not recognize 'python' as a command.
If you do have Python installed, you can skip to the section on installing Geany.
Since you're installing Python yourself starting out fresh, it's a good idea to just install the newest stable version of Python. Most people who still use Python 2 do so because they have to maintain large projects that were originally written for Python 2. Unless you know you'll have to maintain a large existing project, you're better off learning Python 3 from the beginning.
The main Python website has a section written just for beginners who are trying to install Python. If you get stuck, take a look at that page and see if anything seems to make sense for your particular system.
Go to the Download page on python.org, and download an installer that's appropriate for your system. Look for a Python 3.4 installer. It's helpful to know whether you're running a 32-bit or 64-bit version of Windows; if you don't know, download a 32-bit installer. 32-bit installers will work on any system; 64-bit installers will only work on 64-bit systems.
Once Python has finished installing, you'll want to make sure it's working. There are several ways to do this.
print("Hello Python world!")
, and press Enter.C:\Python34\python
, and press Enterprint("Hello Python world!")
, and press Enter.Hello Python world!
------------------
(program exited with code: 0)
Press return to continue
You'll probably see an error message, because Geany doesn't know where Python lives on your system. We'll fix that in the next section.
You probably have to configure Geany to tell it how to find the version of Python that you just installed.
Open Geany, and open a Python Hello World program. If you don't have one on your system, write one and save it as hello.py, and run the program. This makes sure that Geany is trying to run Python programs. When you have a running hello.py program, go to Build >> Set Build Commands.
Under 'Python commands', look for the 'Compile' line. Enter the following in the 'Command' box. Make sure you get the spaces right. You should have 'C:\Python34\python' followed by a space, and the rest of the command. If you have 'Python 34', with a space between Python and 34, Geany will not be able to run your code. Also, make sure your capitalization matches what you see here exactly.
C:\Python34\python -m py_compile "%f"
Under 'Execute commands', look for the 'Execute' line. Enter the following in the 'Command' box, paying attention once again to the spaces.
C:\Python34\python "%f"
Test your setup by running hello.py again.
If you installed Python 2.7 instead of Python 3, the commands you want are probably:
C:\Python27\python -m py_compile "%f"
and
C:\Python27\python "%f"
If Geany still can't run your hello.py program, check to see if your installation of Python is somewhere else.
C:\Python
xxx\python
.