Chromebook guide

How to Run Python on a Chromebook

There are two ways. The fastest is an online Python editor in Chrome: nothing to install, and it works on school Chromebooks where Linux is turned off. The other is ChromeOS's Linux development environment, which gives you Python 3 in a terminal.

Which way to choose

Online editor in ChromeLinux on the Chromebook
SetupNone, open a web pageSet up Linux (10 minutes or more, a few GB of storage)
School ChromebooksWorks, it only needs the browserOften blocked by the school's admin
LibrariesNumPy, pandas, Matplotlib, SciPy and scikit-learn ready to importInstall what you need with pip in a virtual environment
Debugger and AI helpBuilt inInstall an editor such as VS Code
Works offlineNoYes
Best forClasses, homework, practice, quick scriptsLarger projects, files on disk, any package

Option 1: run Python in Chrome (no setup)

  1. Open the online Python editor in Chrome.
  2. Type or paste your code, or start from the example below.
  3. Select Run. The output appears in the terminal panel, and the program can ask for input while it runs.
  4. Sign in with a free account to keep your files, or select Share to get a link to your code.
hello.py
hello.py
name = input("What is your name? ")
print(f"Hello, {name}! Python is running on your Chromebook.")

for number in range(1, 6):
    print(number, "squared is", number ** 2)

The editor also has a debugger, a step-by-step visualizer and a Matplotlib editor for charts. Teachers can give assignments to a whole class with CodeUtility for Teachers.

Option 2: install Python with Linux on a Chromebook

  1. Select the time at the bottom right, open Settings, then go to About ChromeOS and Developers (on older versions: Advanced, then Developers).
  2. Next to Linux development environment, select Set up and follow the instructions on the screen. Setup can take 10 minutes or more; when it finishes, a Terminal window opens.
  3. Check Python with python3 --version. The Linux environment is Debian, which comes with Python 3.
  4. Save your code in a file such as hello.py in the Linux files folder, then run it with python3 hello.py.

To install packages, create a virtual environment first; Debian does not allow pip to change the system Python:

sudo apt update
sudo apt install python3-venv python3-pip
python3 -m venv ~/venv
source ~/venv/bin/activate
pip install numpy pandas matplotlib

For an editor, install the Linux (.deb) version of VS Code, or use a simple editor such as the Text app and run files from the terminal. More on running scripts: how to run a Python script.

If Linux development environment is missing or greyed out, your Chromebook is managed by a school or company that turned it off, or the device is too old. Use the online editor instead.

What to do next

Frequently asked questions

Can you run Python on a Chromebook?

Yes. The quickest way is an online Python editor in Chrome, which needs no setup. You can also turn on the Linux development environment and use the Python that comes with it.

Why can't I turn on Linux on my school Chromebook?

Schools often disable Linux in the admin console. In that case use an online editor, which only needs the browser.

Does the online editor support libraries such as NumPy and pandas?

Yes. NumPy, pandas, Matplotlib, SciPy and scikit-learn are already installed, so you can import them without pip.

Can I save my programs?

Yes. Sign in with a free account to keep your files in a workspace, or use Share to get a link to your code.

Does it work offline?

No. The online editor needs an internet connection. For offline work, use Python in the Linux environment.