How to run Python code on Chromebook

Share

In the era of Machine Learning and AI, the programming language Python has been the driving element for many of the innovations. For programmers, Linux is usually the first priority due to its flexibility. What if you have a Chromebook and would like to run a couple of Python codes? Well. there is a workaround to do so.

how to use python on chromebook

Must See: How To Split Screen on Chromebook

In this article, we’ll discuss how to run Python on a Chromebook powered by ChromeOS. You have to initially set up a Linux Environment which in case if you don’t know how to, go through the guide given below.

Skip to II procedure, if already set up a Linux Environment.

I. Setting Up Your Linux Environment

This step may or may not involve some settings and features you may not have used before. In order to run many of the popular programs or IDE’s, we need to have Linux deployed so we can make use of a Linux terminal. The terminal then will be used to download languages, libraries, and IDEs (Integrated Development Environments).

So, without any further ado, let’s dive in!!! This is going to be an interesting guide.

  1. Tap or click on the gear icon present in the taskbar to open the “Settings” menu. Couldn’t find it? Tap on your clock to find the gear to open the “Settings”.how to run python code on chromebook
  2. It’s always good to make sure the Chromebook is up to date before proceeding. If not updated, go to the settings menu and find the “About Chrome OS” option.how to run python code on chromebook
  3. Tap on the “About Chrome OS” >> “Check for updates” button. Tap “Check for updates” to install the latest updates if any to your Chromebook.how to run python code on chromebook
  4. Then go back to the main settings menu, where you will see a little penguin vector graphics next to an option that reads “Linux (Beta)”.
  5. Tap the “Linux (Beta)” menu item.how to run python code on chromebook
  6. The Linux Beta will open a section: “Linux – Run Linux tools, editors, and IDEs on your Chromebook”.
  7. Tap the “Turn on” button to switch this setting on.how to run python code on chromebook
  8. A toast will appear asking your permission to install Linux. Tap the “Install” button.how to run python code on chromebook
  9. Sip a coffee or tea, sit back relaxing for a while. Let the Linux installs on your computer.how to run python code on chromebook
  10. Once completed, a Linux terminal will open on your computer. yourusername@penguin:~$
    python on chromebook
  11. Yes, it’s done. To get all the new features, let us search for updates to any current packages and dependencies by typing sudo apt-get update. The terminology sudo, a command basically means “superuser do”, which tells the terminal that we are the superuser and that we have the permission to run this command.

II. Python Installation Troubleshooting

  1. To know which version of Python 3 you have! We can do this by typing the command python3 -V into your terminal window. Note, you should type only python3 -V and not python -V! Typing python will check the Python 2 version which does not come preinstalled.

    yourusername@penguin:~$ python3 -V
  2. Once executed, it should display your Python 3 version.

    yourusername@penguin:~$ python3 -V Python 3.7.3
  3. If it didn’t output any string or version (or mostly if you input python instead of python3), you will see something like:

    yourusername@penguin:~$ python3 -V -bash: python3: command not found

To download a new Python version on your machine, continue to the “Installing a New Python Version” section. If you already have the version of Python you want to be installed on your machine, skip “Installing a New Python Version”

III. Updating Python Version

If you need to have a specific version of Python3, you may check the below section.

Suppose that we have Python 3.7.3, and we need the latest Stable Release Python 3.8.8. To do that…

      1. You may download the Python 3.8.8 source file by using the wget command in the terminal or from Python.org’s source page. We recommend the former; wget.

        Using wget command

        First, you’ll need to move into the /usr/src folder in your terminal. Then, when using the wget command, you would change the Python version to match the one you are trying to download:

        yourusername@penguin:~$ cd /usr/src
        yourusername@penguin:/usr/src$ sudo wget https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tgz

    That’s it, you have successfully set up Linux Environment and installed the necessary Python collaterals. Now you can make use of any IDE, coding environment such as Visual Studio, Jupiter or directly code using the Linux Terminal.

Also Read: Google Tweaks Start Page of Incognito Mode for Chrome

If not able to code, do let us know in the comments.

Ijaz
Ijaz
Decode my name to decode my norm. Been Contributing in tech industry from past many years. Now, I'm working in an MNC.

Read more

Local News

Google TV Streamer’s Home Panel Now Accessible on Older Devices

Great news for Chromecast and Google TV users. Google is slowly introducing new Google TV Streamer features to older devices. Earlier this month, users...

Google Unveils ‘Hold Close to Cast’ Feature for UWB Pixel Phones and Tablets

In the era of streaming, moving media between devices has become simpler, and with Google’s new “Hold close to cast” feature currently available on...

Pixel 6 Devices Hit by Bricking Issue After Android 15 Update

It has been almost a week since Google started releasing the Android 15 update for Pixel devices. The new Android 15 has several improvements...

Google Photos rolled out desktop folder backups

Google Photos just launched an amazing new feature that lets users easily back up folders from their PC to the cloud directly through its...