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 Chrome | Linux on the Chromebook | |
|---|---|---|
| Setup | None, open a web page | Set up Linux (10 minutes or more, a few GB of storage) |
| School Chromebooks | Works, it only needs the browser | Often blocked by the school's admin |
| Libraries | NumPy, pandas, Matplotlib, SciPy and scikit-learn ready to import | Install what you need with pip in a virtual environment |
| Debugger and AI help | Built in | Install an editor such as VS Code |
| Works offline | No | Yes |
| Best for | Classes, homework, practice, quick scripts | Larger projects, files on disk, any package |
Option 1: run Python in Chrome (no setup)
- Open the online Python editor in Chrome.
- Type or paste your code, or start from the example below.
- Select Run. The output appears in the terminal panel, and the program can ask for input while it runs.
- Sign in with a free account to keep your files, or select Share to get a link to your code.
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
- Select the time at the bottom right, open Settings, then go to About ChromeOS and Developers (on older versions: Advanced, then Developers).
- 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.
- Check Python with
python3 --version. The Linux environment is Debian, which comes with Python 3. - Save your code in a file such as
hello.pyin the Linux files folder, then run it withpython3 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.