How to Install Python
Estimated completion time: 1 hour
There are three parts to the pre-work:
There are three parts to the pre-work:
- Installing a text editor
- Installing Python
- Setting Up Your Command Line
1. Install a text editor
You'll need to install a text editor for writing code. We'll be using a popular text editor called Visual Studio Code (though for the purpose of this tutorial, it doesn't really matter what you use, so if you have a preferred text editor then go for it).
You'll need to install a text editor for writing code. We'll be using a popular text editor called Visual Studio Code (though for the purpose of this tutorial, it doesn't really matter what you use, so if you have a preferred text editor then go for it).
- Go to code.visualstudio.com and download the installer for Visual Code Studio. (Don't worry, it's free.)
- Install Visual Code Studio and make sure it's easily accessible on your computer.
2. Install Python
There are several ways to install Python on your computer. We'll be using a simple installer called Anaconda.
There are several ways to install Python on your computer. We'll be using a simple installer called Anaconda.
3. Set Up Your Command Line
The command line is where you run your code once you've written it, and it's already installed by default on most computers.
macOS:
On macOS we're going to use Terminal.
On Windows we're going to use Anaconda PowerShell Prompt.
The command line is where you run your code once you've written it, and it's already installed by default on most computers.
macOS:
On macOS we're going to use Terminal.
- Hold down the command key and hit the spacebar. A "search bar" will pop up.
- Type: Terminal
- Click on the Terminal application that looks kind of like a black box. This will open Terminal.
- You can now go to your dock and right-click on the Terminal icon to pull up the menu, then select Options->Keep In Dock.
On Windows we're going to use Anaconda PowerShell Prompt.
- Click Start.
- In "Search programs and files" type: Anaconda Powershell Prompt
- Click on the Anaconda Powershell Prompt application that looks kind of like a black box. This will open Anaconda Powershell Prompt. Warning: Windows comes with other similar-looking but different applications (e.g. Anaconda Prompt, Windows PowerShell, Windows PowerShell ISE). Don't open those.
- You can now go to your taskbar and right-click on the Anaconda Powershell Prompt icon to pull up the menu, then select Pin to taskbar.
A Quick Sanity Check
To make sure you got Python installed properly, open a new command line window (Terminal or Anaconda PowerShell Prompt), then type just python --version (with a space in between) and hit enter.
To make sure you got Python installed properly, open a new command line window (Terminal or Anaconda PowerShell Prompt), then type just python --version (with a space in between) and hit enter.
(Don't worry if your command line doesn't look like ours.)
If you have Python 3.8 or above, you're all set!
Some Common Issues:
If you have Python 3.8 or above, you're all set!
Some Common Issues:
- If you get one of the following errors: python : the term 'python' is not recognized as the name of a cmdlet or pip : the term 'pip' is not recognized as the name of a cmdlet... then make sure you go back and check the "Add Anaconda to my PATH environment variable" option during the installation process. Go back and redo the installer making sure you select that option.
- Operation not permitted error when trying to run the python command on a Mac. You may need to follow these instructions to give your Terminal application Full Disk Access.
- Make sure you restart your computer after running the Python installer.
- Make sure you only type python --version in the prompt (no quotes, no spaces, no punctuation, nothing).
- You may have to disable antivirus temporarily.
- If you're using a work computer and it doesn't let you install Python or a text editor, you may need to contact your IT team.