From the course: Introduction to Python: Learn How to Program Today with Python by Pearson

Install Python

All right, the first thing that we're going to need to do is look at the course files on GitHub, make sure you have them on your computer. It's also going to have links for all of the downloading and like downloading Python, downloading PyCharm and stuff like that. So let's get that out of the way first. So you can go to here, Intro to Python 2nd Edition. And in the readme down here are all of the links that you'll need and the instructions. Hopefully, it doesn't take you too long to get everything set up. But if you are having any problems, you'll probably find it somewhere in here. And worst case scenario, you can e-mail me and my e-mail is here. So you can click on the code. If you know Git and have it installed, you can clone it. Or you can download the zip file, unzip it, and move it to a good location on your computer where you'll find it. And then next, you're going to want to install Python. So there's the official installer from python.org. That will work if you're on Mac or Windows. Windows also has an option to download from the Microsoft Store. And then on Linux, because there's so many different distributions, there's no standard installer. So you can use your package manager to get Python, or you can build it from source code. In addition to these kind of three general ways of getting Python, There are a few more, Anaconda is one. If you're planning on using Python for data analysis, scientific computing, AI, this might be a good option for you. It's a full suite of tools and it can run not just Python, but like C code and R code and stuff like that. It includes everything that the python.org version has, as well as some additional packages for data science, as well as the Spyder code editor. So be warned though, if you do get everything through Anaconda, it has its own system for managing packages and environments. So it might be harder to follow certain tutorials like this one that are not data specific. Okay, another tool you can use is called pyenv. And this is good for like server management, where you can install different versions on your computer through the command line and make updates if there are any security patches and things like that. But it's also just a good way if you're on Linux and your package manager doesn't have the version of Python that you're looking for, you can get it through pyenv. If you're using pyenv on Windows, just note that the base package doesn't support Windows, so you can use pyenv-win instead. Okay, so going back to the official Python installer, you can go to python.org downloads. Just click the yellow button here to download the latest version. Currently, it's Python 3.13, and the new version gets released every year. So you might be on 3.15, 3.20, and that's fine. OK, once you have that, you can just run through the basic installer if you're on Mac. If you're on Windows, there are a few configuration options you might want to know about before you go through the installation, and I have those listed here. So feel free to read this if you are on Windows and want more control over your installation, like being able to install it for all users on a computer. Once you have Python installed in a way to check to make sure that it is actually installed properly is to open up a command line. So in Mac or Linux that would be your terminal application and on Windows it would be PowerShell. And then you can try to figure out which Python command will work or which Python command gives you the correct version that you just downloaded. So I'm going to open up my terminal here and try those different commands. If I say Python dash dash version, okay that same command not found. So that's not the one I'm going to use. Python 3 dash dash version, that points to 3.13. If it didn't, and 3.13 is the one I currently want, if it didn't you could always target it more by specifying the minor version. So for example 3.12 is installed on my computer as well. So if I did want to target 312, I would use this command instead. But for the rest of this course, I'll use the Python 3 command where applicable. But in general, you don't actually need to do any of this for this course because we're going to be running Python through PyCharm or our code editor. But this is just a way, like if you are following along with tutorials and you see the Python command, make sure to replace it with the appropriate one that's pointing to your version. Also a note on PowerShell or in Windows, so if you did install Python on Windows using the default Python.org installer, you might not have any of those Python commands working, which is fine. On Windows, Python installs something called PyLauncher and you can access that with the py command. I can just show you what that looks like. Here I'm in PowerShell. The py command gives me this version. I don't think I have 3.13 installed. Nope, but I do have 3.8 installed, and that works. On Windows, I need to use Pi instead of Python, then to target the specific version, we use the dash three-point number. Then also just to show you what it looks like if you open up the Windows Microsoft Store and search for Python. The different Python versions are also available here, but these will download just to your user, and they will give you the Python command, not the PyLauncher command. Next, we're going to look at running Python in a code editor. I'll be using the PyCharm Community Edition.

Contents