Are you a Chromebook user? We love our Chromebooks, and some (but not all) can indeed be used to learn and code Python.
Can Your Chromebook Run Python?
Chromebooks are essentially web browser computers. That means that Chromebooks are primarily used for applications and sites that run inside of web browsers. Pretty much anything that you can access via a web browser will run on Chromebooks.
But can Chromebooks run desktop apps, or apps that need to be installed? The answer is it depends. Chromebooks can’t run programs made for Windows or Mac, so anything that requires a Windows or Mac download and installation (like Python and Visual Studio Code) can’t run on Chrome OS (the Chromebook operating system).
Recognizing that you may actually need to install downloadable apps on your Chromebook, Google did provide a couple of options.
- Some Chromebooks can run Android apps, so many of the apps on the Google Play Store can be installed on Chromebooks that support Android. But, Python and VS Code are not Android apps, so this option won’t help us.
- Newer (and more powerful) Chromebooks can run Linux. What is Linux? It’s an operating system (like Windows and Mac OSX) and it actually powers a huge chunk of the internet. Linux is mostly used with a command prompt (all text), although Linux desktop user interfaces do exist. And, as we noted, some Chromebooks can run Linux, effectively running a second computer inside of the Chromebook. And that second Linux computer can indeed run Python and VS Code.
So, can you code with Python on your Chromebook? If your Chromebook supports Linux, then yes. If not, then not.
We should note that even if our Chromebook does support Linux, getting things installed and set up is not quick or painless. But the good news is that you’ll need to go through the set up only once, and once installed, coding will be as simple as clicking the VS Code icon on your Chromebook desktop.
Linux on Chromebooks
To determine if your Chromebook can run Linux, do the following:
- Go to Chromebook Settings (at the bottom right of the screen).
- Select the Advanced screen.
- Then click on Developers.
- Look for Linux development environment, if that option exists, then you’re in luck, your Chromebook can run Linux.
To installing Linux on Chromebooks just Turn On next to the Linux development environment. Chromebook will download, install, and configure Linux. This process could take 5-10 minutes, so be patient.
Oh, and if you no longer need Linux on your Chromebook, come back to this same screen and select Remove.
You can find more details on this Google Support page.
Installing Python on Linux
The first thing you need to code with Python on your Chromebook is, well, Python. And you may luck out and find that Python is already installed as part of your Linux installation. To check, click on the Linux icon to launch the Linux desktop. At the prompt type:
python3 -V
Make sure you use -V
(that’s a capital V, now a lower case one). Press Enter. If you see a message with a Python version number then you have Python installed. Yeah! If you see a command not found
error message, well, you don’t have Python installed and will need to do so.
If you do need to install Python (either because it’s not installed, or because you need a newer version), you can do so using this apt install command:
sudo apt install python3
You should see Python downloaded and installed. If that does not work, try these commands:
sudo cp /etc/apt/sources.list sources.list
sudo echo deb https://deb.debian.org/debian sid main | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install python3 python3-pip build-essential libssl-dev libffi-dev python3-dev -y
sudo mv sources.list /etc/apt/sources.list
sudo apt update
When done, try the following command again. If you see the Python version number displayed, then you are good to go.
python3 -V
Installing Visual Studio Code on Linux
Installing Visual Studio Code on Linux is not a simple download and click, but it’s not that onerous. Microsoft has posted detailed instructions here.
Leave a Reply