How to Install Python on Your Computer

Install Python on Windows, macOS or Linux, set up VS Code and run your first Python file on your own computer, step by step in about 15 minutes.

AAyim Nelson23 Nov 20265 min read3

Everything in JeliScript's Python Crash Course runs right in your browser, so you never have to install anything. But sooner or later you'll want Python on your own computer: to build bigger projects, work with files, install packages, or just code without an internet connection.

This guide takes you from nothing to running your first Python file, on Windows, macOS or Linux. It takes about 15 minutes.

What you'll do

  1. Check whether Python is already installed
  2. Install Python
  3. Check that it works
  4. Install a code editor
  5. Write and run your first file, hello.py

Step 1: Check whether Python is already installed

Open a terminal: a window where you type commands.

  • Windows: press the Windows key, type PowerShell and open it.
  • macOS: press Cmd + Space, type Terminal and press Enter.
  • Linux: press Ctrl + Alt + T, or open Terminal from your apps.

Type this and press Enter:

python --version

On macOS and Linux, also try:

python3 --version

If you see something like Python 3.14.2, Python 3 is already installed and you can skip to Step 4. If you see an error, a version starting with 2., or the Microsoft Store opens, carry on with Step 2.

Step 2: Install Python

Windows

  1. Go to python.org/downloads and click the big Download Python button for the latest version.
  2. Open the file you downloaded.
  3. Important: on the first screen, tick "Add python.exe to PATH" at the bottom. This lets you type python in any terminal. It's the most common thing beginners miss.
  4. Click Install Now and wait for it to finish, then click Close.

Note: newer Python releases for Windows also offer the Python install manager. If the download page gives you that instead, install it, then open a new terminal and run py install. After that you run Python with py (for example py hello.py).

macOS

  1. Go to python.org/downloads and download the latest macOS installer (a .pkg file).
  2. Open it and click through the installer: Continue, Agree, Install. Enter your Mac password if asked.
  3. When it finishes, a Finder window opens. Double-click Install Certificates.command once: it lets Python download packages securely.

On a Mac, use python3 (not python) in the terminal.

Linux

Most Linux systems already have Python 3. If yours doesn't, install it with your package manager. On Ubuntu or Debian:

sudo apt update
sudo apt install python3 python3-pip python3-venv

On Fedora:

sudo dnf install python3 python3-pip

On Linux, use python3 in the terminal.

Step 3: Check that it works

Close your terminal and open a new one (it only learns about newly installed programs when it starts). Then run:

python --version

On macOS or Linux, use python3 --version. You should see Python 3. followed by a version number. ๐ŸŽ‰

You can also start Python's interactive mode by typing python (or python3) on its own. You'll see >>>: type print("Hello!") and press Enter. Type exit() to leave.

Step 4: Install a code editor

You can write Python in any text editor, but a code editor makes life much easier: it colours your code, points out mistakes and runs your programs with one click.

We recommend Visual Studio Code (VS Code). It's free and works on Windows, macOS and Linux.

  1. Download it from code.visualstudio.com and install it.
  2. Open VS Code, click the Extensions icon on the left (four little squares), search for Python and install the one by Microsoft.

Step 5: Write and run your first file

  1. Make a new folder for your Python work, for example python-projects in your Documents folder.
  2. In VS Code, choose File โ†’ Open Folder and open that folder.
  3. Choose File โ†’ New File, name it hello.py, and type:
name = "Ama"
print(f"Hello, {name}! I'm running Python on my own computer.")

Save the file (Ctrl + S, or Cmd + S on a Mac). Now run it in either of two ways:

  • Click the โ–ถ Run button in the top-right corner of VS Code, or
  • Open the terminal inside VS Code (Terminal โ†’ New Terminal) and type:
python hello.py

On macOS or Linux, type python3 hello.py. You'll see:

Hello, Ama! I'm running Python on my own computer.

That's it: you're running Python locally. ๐Ÿš€

Bonus: installing packages with pip

pip installs packages, which is code other people have written and shared, from the Python Package Index. Inside a project it's good practice to use a virtual environment, a private space for that project's packages, so projects don't clash:

python -m venv .venv

Then switch it on:

  • Windows (PowerShell): .venv\Scripts\Activate.ps1
  • macOS / Linux: source .venv/bin/activate

Now install packages with, for example, pip install requests. You'll learn more about modules and pip in the course.

Troubleshooting

  • "'python' is not recognized" (Windows): Python wasn't added to PATH. Run the installer again, choose Modify (or reinstall), and tick "Add python.exe to PATH". You can also try py --version.
  • Typing python opens the Microsoft Store: open Settings โ†’ Apps โ†’ Advanced app settings โ†’ App execution aliases and turn off the two python entries. Then open a new terminal.
  • "command not found: python" (macOS / Linux): use python3 instead of python.
  • The version shown starts with 2.: that's an old Python. Use python3, or install the latest version as shown above.
  • It works in one terminal but not another: close every terminal window and open a new one after installing.

Back to the course

Now that Python is installed, you can run every example from the course on your own computer too. Copy any code box into a .py file and run it with python yourfile.py.

๐Ÿ‘‰ Return to the Python Crash Course and carry on from where you stopped. Your progress is saved.

Stuck on a step? Ask in the JeliScript forum: someone will help you get set up.

Comments

Log in to join the conversation.

Loading comments...