• Installing Python
  • Code and Data
  • For Instructors
  • Contact the Authors
PYTHON FOR MBAS
  • Installing Python
  • Code and Data
  • For Instructors
  • Contact the Authors

How to Install Python

Estimated completion time: 1 hour
There are three parts to the pre-work:
  1. Installing a text editor
  2. Installing Python
  3. 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).
  1. Go to code.visualstudio.com and download the installer for Visual Code Studio. (Don't worry, it's free.)
  2. 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.
  1. Download the latest version of the Anaconda installer for Windows, OSX, or Linux.
  2. Accept most of the defaults for installation (just click "Continue" or "Next" the whole way).
  3. Mac users: If you run into the following error, click "Install for me only" again and you should be able to continue.
Picture
​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.
  1. Hold down the command key and hit the spacebar. A "search bar" will pop up.
  2. Type: Terminal
  3. Click on the Terminal application that looks kind of like a black box. This will open Terminal.
  4. 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.
Windows:
On Windows we're going to use Anaconda PowerShell Prompt. 
  1. Click Start.
  2. In "Search programs and files" type: Anaconda Powershell Prompt
  3. 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. 
  4. 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.
Picture
(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:
  1. 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.
  2. 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.
  3. Make sure you restart your computer after running the Python installer.
  4. Make sure you only type python --version in the prompt (no quotes, no spaces, no punctuation, nothing).
  5. You may have to disable antivirus temporarily.
  6. 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.
Python for MBAs™
Copyright © 2021 ​
Mattan Griffel and Daniel Guetta 
All rights reserved.
Installing Python
Code and Data
​Typos and Corrections
​For Instructors
Contact the Authors
  • Installing Python
  • Code and Data
  • For Instructors
  • Contact the Authors