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.
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.
- 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”.
- 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.
- Tap on the “About Chrome OS” >> “Check for updates” button. Tap “Check for updates” to install the latest updates if any to your Chromebook.
- 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)”.
- Tap the “Linux (Beta)” menu item.
- The Linux Beta will open a section: “Linux – Run Linux tools, editors, and IDEs on your Chromebook”.
- Tap the “Turn on” button to switch this setting on.
- A toast will appear asking your permission to install Linux. Tap the “Install” button.
- Sip a coffee or tea, sit back relaxing for a while. Let the Linux installs on your computer.
- Once completed, a Linux terminal will open on your computer. yourusername@penguin:~$
- 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 terminologysudo
, 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
-
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 onlypython3 -V
and notpython -V
! Typingpython
will check the Python 2 version which does not come preinstalled.yourusername@penguin:~$ python3 -V
-
Once executed, it should display your Python 3 version.
yourusername@penguin:~$ python3 -V Python 3.7.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…
-
-
- 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
- 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.
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.