Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Let's take a look at how you can install Python and the Eclipse environment on a Windows PC. I am using a Windows 7 PC here. This same procedure should work for any kind of modern Windows. This is the download page for Python 3.1.2. Use the downloader or installer for whatever version of Python is the latest. If I scroll down here, you will see that there is downloads available for a number of operating systems. I am going to pick the one for this Microsoft Windows box, and I have already actually downloaded this, so I have got that already in my Download folder.
Let's also go ahead and download Eclipse. Now in order to install Eclipse, you must have Java installed, and you should probably have the latest Java installed. So I strongly recommend that you make sure that your computer has Java, and it's the latest version of Java. Windows machines do not necessarily come with Java already installed. So you need to make sure that you have Java installed before you install Eclipse. Eclipse is designed to be a development environment for the Java language. We are using it here to develop in Python because it has a lovely plug-in available for Python development, and that works really well.
Here, on the download page for Eclipse, you will notice that there are a lot of choices, and any one of these will actually work. We are going to install the basic Eclipse Classic. Most of the time, when you hover over this link here whatever operating system you are working with, it will get the proper download for your operating system. If you are not sure, you can select the one that you want from this list over here. So let's go ahead and get started with the installation. First, we are going to install Python, and that involves double-clicking on this installer, and I will say Run.
I'm going to go ahead and Install for all users, and I am going to install it in the default location, and I want to make a note where that is. That's Python31 folder, right off of the C disk. Again, I am going to accept the defaults. It's installing everything, and we want that, and then it just goes ahead and does its thing. Now let's go ahead and run IDLE and make sure that it works. There it is, so now we know that we have Python 3.1.2 installed, and it's working.
Now we are going to install Eclipse. Eclipse comes to us in a zip file, so I am going to Extract All just to this default location in my Downloads folder. Now we have the eclipse folder, so I am just pressing Ctrl+N to open another Explorer window, and we'll come down here and find Program Files, and I am going to install it on Program Files (x86) because I don't loaded the 32 bit version. You can put it in the other one if you want to, and I am just going to drag this over here and move it to Program Files.
So I don't want it to go in one of these other folders, so I am going to actually drag it into this part of the window here where it says move to Program Files, and I will Continue and authorize, and there it is. I will open this up, and there is eclipse.exe. I am going to pin it to the Start menu. Now, there it is in my Start menu. So I can close this window, I can close this window, and I no longer need this empty folder here. I will just go ahead and delete that.
Now it's time to start Eclipse. There is still quite a bit left to do here. I am accepting that and running it. I am going to accept the default location for my workspace. I am going to say use this as a default so you don't ask me again. And you can put your workspace wherever it makes sense for you. And now we are running Eclipse but it's not ready to use at all yet. First thing we need to do is we need to install Pydev. That's the development environment for Python. And under the Help menu, you will see there is a selection for Install New Software, and before we can even type something in here, we need to click on this Available Software Sites preferences and Add a new software site.
The URL for this is pydev.org/updates. We are going to call this Pydev, and say OK, and OK. Then up here, we can just start typing Pydev, and we will see that it comes up, so we select that, and it says Pending, and then we check on the one that says Pydev. You probably don't need this Mylyn Integration unless you know that you do, and if you are using Mylyn, by all means, go ahead and add that.
So now I am going to say Next, and it found it, and so I am going to select that and press Finish. And now it's installing the Pydev development environment for Python within Eclipse. Say OK to the unsigned content warning, and it is strongly recommended - it says so right there - that you restart Eclipse, and there is no reason not to, so we will just say OK. All right, we are getting closer. So now we have some configuring to do. We are going to open the Preferences, which is under the Window menu, and we are going to come down here to Pydev and click on the little arrow, and then you are going to click on Interpreter - Python, and we are going to need to add our Python interpreter.
So we will click New, and we will click Browse and remember where Python is. It's under the C drive and in Python 3.1, and there is our Python interpreter. Click Open, and we will just name this Python 3.1 and say OK. Now you will get this Selection Needed window. You just take the defaults and select OK Once you have all of this, you select OK, and this will take a few minutes. Now that you have configured the Python interpreter, you can create your first project.
So under the File menu, you hover over New and you come down here and you select Project. Under the Selection Wizard, you click on the little arrow next to Pydev and you select a Pydev project and click Next, and you want to give it a Project name. I am going to call this Python 3 Essential Training, and you want your Grammar Version should be 3.0, and your Interpreter will be 3.1 Interpreter. Project type should be Python and click Finish, and it says it's the Pydev perspective. You can say Yes for that, and over here in the Perspectives, slide this over and right-click on the Java and click Close and slide it back over, unless you are actually going to be working in Java, in which case, you might want to leave that.
So now we are going to add a folder to our project. I'm going to right-click on Python 3 Essential Training, and I am going to say New > Folder. I am going to click on Advanced and Link to folder in the file system, and then I am going to browse, and I am going to find my exercise files for this course and I put that in my desktop, and there is Exercise Files, and I will select OK, and so Link to folder in the file system is checked, and the parent is this Python 3 Essential Training. I am going to say Finish and there is my Exercise Files.
So this did not copy the Exercise Files into my Project folder; It simply linked to it. And so, almost there. We are going to go back into the Preferences, and under Pydev and under Editor, we are going to find this thing called Hover. If Show docstrings is checked, you might want to uncheck it; you can try it both ways, but for my purposes in demonstrating, I have unchecked it. Feel free to try it both ways and see how that works for you. So what this does is when you hover over an object in Python, it shows the entire documentation.
It pops up on the screen, and personally I find that this gets in the way. You may find it helpful. So feel free to try it both ways. I have got it unchecked on mine. Finally, under General > Editors > Text Editors, you want to make sure that Show line numbers is checked, because that's going to be useful. So we will select OK, and feel free to look through the Preferences and experiment with some of the other options. And now we are going to go ahead and just load up our Hello World program and run it. And so I will select Python Run and OK, and there we have it.
So we have installed Python, we have installed Eclipse, and we have installed the Pydev development environment, and we have configured it so we can use it for Python development, and you can use this environment to follow along with the exercises in this course.
Get unlimited access to all courses for just $25/month.Become a member