Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Due to its power, simplicity, and complete object model, Python has become the scripting language of choice for many large organizations, including Google, Yahoo, and IBM. In Python 3 Essential Training, Bill Weinman demonstrates how to use Python 3 to create well-designed scripts and maintain existing projects. This course covers the basics of the language syntax and usage, as well as advanced features such as objects, generators, and exceptions. Example projects include a normalized database interface and a complete working CRUD application. Exercise files accompany the course.
So now we are going to install Python and Eclipse on a Mac. So this is the Python download page, and you will see I have already downloaded Python 3.1.2 Mac OS X Installer Disk Image. So if you are on a Mac, that's the one that you want to download. If the version number is a little bit higher, if it's a later version, go ahead and install the later version. That should work just fine. Then you want to download from the Eclipse download page, and Eclipse is written in Java, and it's actually a Java development environment, and so you will see that there are a lot of different choices.
If you are a Java developer and you want to install one of these other ones, that's fine. Go ahead and do that. For my purposes, I am just getting the Eclipse Classic, because I am really just using it for Python development today. And you'll notice that when I run the mouse over this, it highlights the one for Mac OS X Cocoa, and that's really the one that you want to install. So I have already downloaded that as well, and here is my Downloads folder, and I have got the Eclipse downloaded, and I have the Python downloaded. So go ahead and close the browser, and we are going to start by installing Python.
So I will double-click on the installer, and I will double-click on the Python.mpkg, and I will say Continue, and Continue, and Continue, and Agree, and Install. I am going to install this in default location. Type in my Password. Mac OS X already comes with Python installed, but it's Python 2, and so you really need to install Python 3 for this course, because this course is about Python 3. That installation is done, and I can unmount this, and I just want to go ahead and go out to my Applications folder, and then I will find Python 3.1 folder, and in there, you'll find IDLE. And I am going to drag that to my Doc because we are going to be using that.
I will go ahead and we'll open it, so it's Python 3.1.2, and that's what we are looking for. So Python is installed and working on this Mac. I will Quit IDLE, and we are going to go ahead now and install Eclipse. So I am going to double-click on the Eclipse installer, and this is going to unarchive it. And it will unarchive the tar file, which is inside of the gz file. And I have got this folder, and all I need to do with at this point is drag this whole folder to my applications folder and I come in here, and I am going to find the folder called Eclipse, and inside of that folder there is the Eclipse application. I am going to drag that to my dock and run it.
So you go ahead and open that. Now there are a few things we need to do to configure Eclipse. First thing, we are going to select a workspace. I am going to allow the default; you are welcome to use whatever folder works for you. I am going to select the check box to use it as a default, so it doesn't ask me again. Now before I do anything else, when Eclipse starts up, under the Help menu, I am going to go to Install New Software, and I am going to select this link. This is Available Software Sites, and I am going to add one, and this is for Pydev, and the URL is pydev.org/updates, with an s at the end.
Say OK, and we see that gets added there, and I say OK, and then all I need to do is select that is go up here and type Pydev, and just the first couple of letters, and I will get this here, and I can double-click on that, Pending, and it finds Pydev. So you want to check Pydev. You don't need to check the Mylyn integration, unless you know what that is, and you are going to be using that. And I will select Next, PyDev for Eclipse, and Next. And I want to accept the terms of the license and Finish, and here we go.
This should take just a moment. At the security warning, you want to say OK, and it is strongly recommended that you restart Eclipse. There is no reason not to. So I am just going to select Yes, and Eclipse will restart. So now I am going to go ahead, and I am going to go to the Workbench. That's this icon over here at the right, and I am going to maximize this on my workspace. You will see over here we have Java selected. I am going to select Other and Pydev and OK, and because I am not going to be doing any Java development, I am just going to right-click on Java and select Close.
Then I can move this over, and there is my Pydev Workspace. Now before we get started, we need to go into Preferences, and under Pydev and Interpreter Python, we need to add our Python Interpreter, and this is so Pydev knows where to look for Libraries, what sort of Grammar to use, things like that. So I am going to go ahead and add it. I am going. It's under browse user > local > bin > python 3.1, and that's an alias, and it's supposed to be. And so when I say OK, it actually goes and it finds what the alias was pointing at.
Under interpreter name, I am just going to type Python 3.1. I am going to say OK, and it will say OK. Now if you are also going to be doing Python 2 development, you might want to add that interpreter as well. I know I am not going to be, so I am going to leave it like this. So now I say OK, and it goes and it finds all of the frameworks, and it finds all the libraries, and it does all of this stuff, and now that's installed. So we are getting closer. At this point, we want to go back into the Preferences, and under Pydev and under Editor, see this thing that says Hover, and see it's a Show docstrings? I uncheck that. I find that very distracting.
It's up to you if you want to uncheck that or not. What it does is whenever you hover over an object in Python, it will show you the entire documentation, and it will pop up for that object. I am sure some people find that very helpful. I find that it gets in the way, so I uncheck that. Also, up here in General and under Editors and Text Editors, I want to check, Show line numbers. I find that very useful, and I think you will too. So now we say OK. Over here in the Pydev Package Explorer, right-click and say New > Project, and select Pydev and select Pydev Project and Next.
And under Interpreter, you want to select the Python 3.1 Interpreter, and under Grammar Version, you want to select 3.0, and make sure it says Python for the project type, and type in the name of project. I am going to call this Python 3 Essential Training, and select Finish. Now I have this project here, and I want to right-click on the project and say, New > Folder, and the parent folder will already be selected as Python 3 Essential Training, and then select the Advanced button and select Link to folder in the system.
Now I am going to select Browse, and on my desktop, I have my Exercise Files folder. So you want to select that wherever it is you put yours. I find the desktop to be very convenient for this. I am going to press Open. And so what this will do is this will add my Exercise folders to this Project folder without actually copying the folder. And so it will be just linked to the folder, and it will use it in place without making another copy of it. So I am going to say Finish, and there it is.
Now just open up Chapter 02 and double- click on hello.py. And the first time you open something up after just installing Eclipse and Pydev and everything, it might take in a moment, and then there it is. We have our Hello, World! It's a very simple Python program. The whole purpose of this program is just as an exercise in getting your development environment running, so it's exactly what it is designed for. So when I select Run, it will ask me to Run As, and I will select Python Run, and say OK, and there we have it. There is our result: Hello, World! So this tells us that Python is installed, that Eclipse is installed, that Pydev is installed, Python Interpreter is configured within Eclipse and Pydev, and the entire environment is running.
So now you have a working Eclipse environment where you can follow along with the exercises and do your own Python development.
Find answers to the most frequently asked questions about Python 3 Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.