This article is not designed to go into great details, but instead it's to help you get up and running as quickly as possible with the python environment. The first thing to do is download and install Python. However there are currently 2 versions of Python, versions 2 and 3. If you already know what version you want to install then go ahead, otherwise we suggest you start with the latest version, you can download Python from here.
Once you have downloaded Python, run the file to install it and follow these simple steps.
- Choice the "Install for all users" and click on "Next >".
- Unless you wish to install Python else where, leave the default directory and click on "Next >".
- You may wish to make a slight change by adding python to the path so you can run your python code from anywhere. Simple select click on the down arrow in the box with the cross in it, where it says "Add python.exe to Path", then select "Will be installed on local hard drive", followed by clicking on "Next >".
- Python has now been installed, complete the install be clicking on "Finish".
Test your Python install
Once installed lets test it is all working by following these further steps.
- Right click on your desktop and create a new "Text Document".
- Once you have created your new file, rename it with the file extension of ".py" and make sure the icon looks like the below to ensure it is associated with python.
- Now lets create some simple code to test all is working. Right click on our ".py" file and select the new option no available called "Edit with IDLE".
- Type the following code into the editor.
print("This is my attempt at Python code...")
- Run your code by selecting the option as illustrated below.
- If you have not already saved your code you will be prompted to as below, simply click on "OK".
- If all has been installed correctly you should get a result like below.
Congratulations you have successful installed and tested Python. The next thing we might want to do is make use of an IDE, such as Eclipse to maximise our coding experience with Python. We will cover this in another article.
Please note that you can now simply open a command (cmd) window and type "python" to enter the python shell where you can write commands directly into the system. We will also cover this topic later.