4 ways to run Python online without installing it (Mac, Windows)
Sometimes you need to run Python without installing it.
In this article, I'll walk you through four different ways to run Python without installing it. You only need two things: an Internet connection and a web browser.
1. Python Official Website
The simplest of the four methods is to use the Python REPL provided by the official Python website.
REPL is short for Read-Evaluation-Print-Loop, and you can think of it as a program that talks to Python.
We type in a line like 2 + 2
, it gives us the answer 4
, and waits for the next phrase.
If you'd like to learn more about Python, please visit the official website.
1.1. How to use Python REPL
To use the REPL, visit the official Python website.
Python official website: https://www.python.org (opens in a new tab)
On the homepage, you'll see a blue menu bar on the first screen, and a section below that introduces some Python syntax. In the top center of this section, there is a yellow square icon. Click this icon.
After a few seconds, you should see the following Python REPL running. Try entering a variety of syntax, starting with simple formulas.
As you can see, you can run a freely available Python program from the official Python website in less than 30 seconds. However, you'll need an editor environment beyond REPL to do the real work.
The three methods below are editor environments, each with their own characteristics. Let's take a look at them one by one.
2. Replit
Replit is a web-based development tool that aims to be an easy-to-use, collaborative IDE. It features an intuitive user interface for beginners and the ability for multiple users to write code together in real time.
2.1. How to use Replit
To use Replit you'll need a login. First, go to the homepage and register.
Official website of Replit: https://replit.com (opens in a new tab)
Click the button shown above to register.
After answering a few questions, you'll be presented with a dashboard like the one below. If you signed up with an email, complete the email verification.
Now it's time to start your development environment. Start a new project with the Create a Repl button. Set the language to Python and enter a title of your choice.
Now enter the desired syntax in the editor window and click on the green button at the top to execute it. The result of the execution will be shown in the console window on the right.
In addition to the console window, Replit comes with a variety of development tools, including a debugger, git, and a database, which most installable IDEs provide. You can also use a package manager like pip, which requires no installation or configuration.
2.2. Disadvantages of Replit
Of course, Replit has its drawbacks. First of all, depending on what you're doing, it may not have enough processing power. If you want to use more CPU resources and memory, you'll have to subscribe to a paid plan.
It also doesn't support GPU usage. So if you're working on a GPU-intensive machine learning or deep learning project, you're better off using one of the other services I've listed below.
3. Google Colab
Google Colaboratory, or Colab for short, is a service provided by Google. Colab is a service specialized for machine learning/deep learning projects.
The main feature is that it supports the use of GPU or tensor-based TPU even for free users. It is also provided in a notebook format, which makes it easy to document tasks such as data cleaning, visualization, and learning model building.
3.1. How to use Colab
To use Google Colab, please visit its official website.
Official Google Colab website: https://colab.research.google.com (opens in a new tab)
On the first screen of the Colab homepage, you can see a sample notebook called Colab Start Page. On this page you can preview the features that Colab offers.
Of particular note is Colab's notebook format. We can put text and code together in a single notebook.
If you look at the screen below, there are buttons at the top to add a block of code and a block of text. Notice the blocks that each button adds. The green text block can be written in a text format such as Markdown or LaTex. The red code blocks allow you to interactively view your code and its results, like a Python REPL.
The possibilities for using code blocks are endless.
Colab comes with many Python libraries built in, so you don't need a package manager to use them.
The code block below uses libraries like numpy
and matplotlib
to achieve the visualization results.
Colab can also be integrated with Google Drive, so you can easily store and retrieve data with a single Google login.
3.2. Google Colab Disadvantages
Here are some of the disadvantages of Google Colab. First, free users can only run working code for 12 hours or less.
Also, if you want more computing power, you may need to consider a paid subscription. Finally, the system is specialized for data science, so if you want to write programs for other purposes, the notebook format may be a turnoff.
4. PythonAnywhere
The last service we'll look at is PythonAnywhere. It was acquired by Continuum, which is known for its Anaconda distribution. It offers a stable and robust development environment.
If Colab is specialized for data science, this service can be used to run projects that work around the clock, such as Python-based web applications.
4.1. Using PythonAnywhere
To use PythonAnywhere, visit the official website and sign up.
PythonAnywhere Official Web Site: https://www.pythonanywhere.com (opens in a new tab)
Click the green button on the first screen to go to the subscription plans page. You can run basic applications with a free account.
Click the blue button to sign up. After logging in, you will see the dashboard as shown below.
Each menu allows you to access the Python console (REPL), write code, and write web applications. Notebook has the same format as Colab, but requires a paid subscription. In this post, I'll only review the console and code editor parts, and I'll use the web app part later when I write a Python web development post.
Selecting a console:
Console window:
When you click the >>>Python button at the bottom of the new console, a new console, the REPL window, is started. It is the same as the one you saw on the official website.
PythonAnywhere provides a cloud directory by default. We can create new files in the cloud directory, or upload files from our own computer. Let's click the Browse Files button we see on the screen.
On the left are the directories, and on the right are the files within those directories. I also see a button to upload files from my computer. Let's open one by clicking on the filename.
An editor window will open and you can write code to this file. The advantage of using the editor is that it comes with a lot of pre-built packages, so in most cases you don't need to set anything up. However, it doesn't offer many of the features of code editors provided by other services, so you may not be able to write code as efficiently.
4.2. PythonAnywhere Disadvantages
The first disadvantage of PythonAnywhere is the lack of editor features mentioned above. Starting a project from scratch can be difficult due to the lack of built-in editor features.
Also, the lack of computing power on the free account and the lack of GPU support means that you'll need to consider the hardware resources your project will require.
5. Final thoughts
So far we've seen four ways to run Python on the web without installing it.
A simple REPL could be run from the official homepage without logging in. For more complex tasks, I recommend using Replit for collaboration and code writing, Colab for data science-oriented tasks, and PythonAnywhere for web applications that need to run 24/7.
However, most of the free, no-install services offer limited computing power and require a paid subscription for more resources. So I think it's important to understand your project's requirements and use the services we've discussed today.
