Will you be using Python on a PC? Learn how to install Python 3 and Komodo Edit on a PC with Windows, for use with the exercise files.
- [Instructor] To follow along with the exercises in Windows, you'll need the latest version of Python 3 and I recommend the free version of ActiveState's Komodo Editor. Here's how to install these components on Windows. Here in my browser I've opened a python.org/downloads and this is where you download Python. You'll notice there's two buttons, one for Python 3 and one for Python 2. You'll want to download Python 3 and not Python 2. Python 2 is for legacy systems and legacy development.
This course is going to teach you Python 3, so you'll need Python 3. So you'll press this download Python 3 button. And I've already done this and I've downloaded it to my desktop so I'm just going to double click on that. And press the install now. And accept the security dialog, and wait for the installation to complete. Once the setup is complete, you simply press the close button and Python is now installed. I'm going to open my browser back up.
I've opened activestate.com/komodo-edit, and this is where we'll download Komodo Edit. You notice over here there's two download buttons, one for Komodo IDE and Komodo Edit. Komodo IDE is the pay for it version which costs about three to $400 for personal use. Komodo Edit is the free version and that's what we're going to use. If you'd like to see the differences, there's a exhaustive list of all the features that are available in the pay version that are not available in the free version.
And if any of those features are worth the money to you, then feel free to use the pay version. I'm going to be using the free version, Komodo Edit, and if you want to follow along and have your screen look just like mine, you'll probably want to use that as well. Just press the download Komodo Edit button and it'll bring you to this separate download page where you can press the big download Komodo Edit button. I've already done that and I've saved the installer here on my desktop. I'll double click on it and we'll go ahead and install it.
So I press next and accept the license terms which I have not read, and press next, and next again, and install. Accept the security dialog and wait for the installation to complete. Now if you want to read the user guide, you can leave that checked. I'm going to uncheck it and press finish. I'm leaving launch Komodo checked so that it'll go ahead and launch. And I press finish and wait for it to launch. The first time you run Komodo Edit you get this little configuration dialog.
For my purposes, I'm going to select a different color scheme. You can use the default or use whichever one you want. I'm going to select this one that says Redmond, it's a little higher contrast for the purposes of this demonstration video. And I'll go ahead and press next. And four spaces of indention is perfect for me, you can change it if you like. If you want your screen to look just like mine, you'll leave it at four. I never like tabs and I'm glad that unchecked by default. I'll go ahead and press next and press finish.
And it'll launch the Komodo Editor. And I'm going to go ahead and maximize this. So I've modified this version to make the interface more readable for the purposes of this video environment. You should configure your copy to your own preferences, and you can do that by pressing on the preferences button here and you can select your interface colors, and you can even come down here to color scheme and you can open the color scheme editor and customize it to your heart's content.
For now what we need to do, for the purposes of using this environment with Python, you'll need to make sure that the Komodo Editor is configured to use Unicode encoding for all the files we're going to use. So we set our default encoding to UTF-8, and if that is not already the default, you want to select that. So this is an internationalization if I didn't say that. You select internationalization over here on the left. And now I'm going to select the Python language.
I need to do this for both Python and Python 3. So we'll start with Python. You notice it says ASC, you want to change that to UTF-8. And Python 3 also to UTF-8. Python 3 is fully Unicode compliant and this makes Komodo work with Unicode characters. So this is very important. Some of our exercises will not work correctly if we don't do this. So now I'm going to press OK, and now we can test everything and make sure that it all works.
So I'm going to come up here to this little gear icon in the left hand pane, and I'm going to open directory and go to my desktop and select the exercise files. I don't want to open it, just select it and press select folder. Now you see my exercise files all show up here on the left. I can move this projects thing out of the way 'cause I don't need it. And there's one final bit of configuration that we need to do. We need to create a run command to run the Python scripts.
You'll remember that this is Komodo Edit, it's not Komodo IDE. So it does not have some of the IDE functionality. We can create that very easily by creating a small run script. So I'm going to open the right pane by pressing this button here. And I'm just going to right click in the empty space here, select add, and add command. New command. That one there. Now under command I simply type py, which is a special command that'll run the Python interpreter.
And press this little button here and select the capital F for file path, like that. And that actually needs to be in quotes, so I'm going to put quote marks around it. And it's very important that all of the characters are exactly like this, lowercase py, space, quotation mark, percent, capital F, and a closed quotation mark. And that will run the Python scripts. So I'm going to select this here.
This is actually for the title, it's not labeled there, but I'm going to type in here run and dash R. Because that'll remind me that I have to press the key binding for R. So we're going to leave that for a moment. We'll do key binding in a moment. We're going to go to advanced options and it's important that start in, we have our current directory. So again, I'm pressing this little arrow over here and the percent D for directory path of file. And then I come over here to key binding.
And there's no current sequence. We're going to add a key sequence that will run this script. So I'm going to press control and shift and hold both of those down and press the R key. So that's Control + Shift + R, which should show up just like that in the dialog box and press the add button. If you don't press the add button, this doesn't get saved. So we have our key sequence there. It says Control + Shift + R. We have percent D here, and we have our run command here. Everything is okay, I'm going to press OK, and there's our run command.
But we don't need that because we can use the hotkey there for it. So I'm just going to close that right pane again. We'll come over here and open up a script. This hello-version.py, press Control + Shift + R and it runs the Python script here in our development environment. So this is perfect, this is exactly what we need. Here's the script in the nice big letters. I've configured this so that you can see it clearly on your screen. Here's the script, and here's the output.
When it runs it says this is Python version 3.6.3. So now everything is working. Python is working, out Komodo Editor is working and it's configured to find our exercise files. We have the run command working and the customized key press to run it. So all I have to do here is load the script up and Shift + Control + R and it runs it. So now I'll just close my script so we're all set up for the first lesson, and that's all there is to it.
Your computer is now setup to run Python scripts in Komodo Edit.
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api