Skip to main content

Python Interactive Shell

How To Open Python on Windows, Mac, Linux • Python Land Tutorial

How To Open Python on Windows, Mac, Linux

You’ll now learn how to open Python on Linux, Windows, and MacOS. First of all, you should know that there are two ways of using Python:

  1. Start an interactive shell, also called a REPL, short for read-evaluate-print-loop.
  2. Start a Python program that you stored in one or more files with the .py extension.

In this tutorial, we’ll start with the interactive shell because it’s ideal for exploring the language. But at some point, using the REPL won’t cut it anymore and you’ll have to start creating Python files.

If you installed Python on your local machine, you first need to start a terminal or command prompt before you can start the Python interactive shell. On all platforms, you should be able to start Python 3 with the command python3 (or sometimes just python). Just be sure you are running Python 3, not 2, because some systems can have both versions installed.

How to open Python on Windows

On Windows, you can start Python from a terminal. E.g., to start PowerShell simply hit the Windows key and start typing “PowerShell”. You can use the ‘Command Prompt’ program if you don’t have PowerShell. When in a shell or command prompt, enter one of the following commands (try them in the given order):

  1. py
  2. python3
  3. python

The first command (py) is a wrapper script that allows you to start the latest version of Python. If it works, great. Just remember that I’ll often refer to python or python3 in the tutorial. You will need to use py in those cases.

How to open Python on Mac

On MacOS, search for a program called terminal. You can do so by pressing the command key (⌘) + space bar. This will open up the Spotlight search bar, in which you start typing the word ‘terminal’.

Once you started the terminal, enter python3 to open the Python REPL. If that doesn’t work, try entering python instead (without the 3).

How to open Python on Linux

On Linux, you first need to start a terminal. This can often be done with the shortcut ctrl + alt + T. Alternatively, you can search for the terminal program in your start menu. The name and where to find it differ from distribution to distribution. Once you have a terminal running, enter python3 to start the Python REPL. If that doesn’t work, try python instead (without the 3).

How to use Python in the cloud (repl.it)

If you have no way of installing Python on your PC, you could use a product like the repl.it cloud-based option. In there, the Python interactive shell is at the right of the screen. You can simply click in the dark shell area and start typing:

Comments

Popular posts from this blog

Ready for Python???

Hey Folks!Welcome to this Python Blog!! Irrespective of new to Programming Language, willing to dive into Python..? Cheers! Yes you are at one of the right places!! Yes you are right with your will and decision, and without wasting much of your time, -> Let me brief somenotable features why to choose python in more simple words and then speak in programming language words... > It has a good attractive style syntax, makes the programs to write easier to read. > Is an easy-to-use language that makes it simple to get your program working. > This makes Python ideal for ad-hoc(as and when required) programming tasks, without compromising maintainability. > It has large standard library that supports many common programming tasks readymade and handy. > Python's interactive mode is an easy way to test small snippets ofcode.Jupyter Notebook users knows this. > Platform Independant(can run on any platform (including Mac...

Quick Start -REPL

Exploring The Python REPL Today We have many IDEs and Many Python program running applications developed and known for ease of use and diverse features. But Working in the terminal is what it is preferred and it is considered as an effective way to learn as a coder. Also it is not the best way to do but one of the best ways to do:) With your terminal open and the Python Interactive shell started, you’ll see a command prompt consisting of three arrows (>>>). The code follows after it. Type 10 in the terminal Exploring The Python REPL With your terminal open and the Python interactive shell started , you’ll see a command prompt consisting of three arrows ( >>> ). Just to be absolutely clear, you don’t type in the three arrows, only what follows after it. Now type in the number 10: >>> 10 10 What happened? Remember we are in a REPL, which is short for Read-Evaluate-Print-Loop: R ead: Python reads 10 E valuate: Python evaluates this input and decides...

Installing Visual Studio(VS Code)

Installing VSCode: How to install and run on Windows, Linux, and MacOS February 1, 2022 Now you know why VSCode is awesome , and why it’s probably the best choice for you too. You probably can’t wait to install VSCode, right? We’ll explore different ways of installing VSCode and how to start it. Table of contents Installing VSCode Starting VSCode Installing VSCode Just like when installing Python , there are a number of ways to install VSCode. Download from the official site VSCode can be downloaded for free from this website . It’s available for the following platforms: Windows Linux MacOS Make sure you download the correct binary for your platform. The website tries to detect your platform automatically and offer the correct link, so that shouldn’t be too hard! After downloading, open the file and follow the steps to install it on your system. Use OS specific package manager On Linux and MacOS, you can use good alternatives to inst...