Getting Started with Python

Install, interact, and learn

Jon Wong
4 min readJun 20, 2021
Image courtesy of RealPython.com

Last updated: 20 Jun 2021

This article is part of a collection of Python articles.

I’ll be covering the installation process for MacOS and Linux, which uses a package manager called Homebrew. If you’re not using MacOS or Linux, and/or you don’t intend to use Homebrew, I can’t help you to install Python (I give reasons further below).

Fire up your terminal

I like to use iTerm2 on MacOS. If you’re on Linux, I would suggest you use the very competent default terminal for your Linux flavor.

(TODO: link to article describing a full Emacs-keybinding MacOS that works perfectly with iTerm2.)

Install Homebrew

If you haven’t already. Installation instructions are at Homebrew’s website.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

Install Python3 (via Homebrew)

  • brew update
  • brew install python3
  • brew info python3
  • brew install python-tk@3.9

Interacting with and Learning Python3

The best way to interact with and to learn Python3 is through a built-in module called IDLE. The official documentation for IDLE is on Python’s official documentation site.

To start IDLE: python3 -m idlelib

The -m means “to run a module”. Notice from IDLE’s official documentation page that the package name is idlelib (not “idle”): Source code: Lib/idlelib/

To execute some Python3 commands:

  • print("hello world")
  • 3+5

To stop IDLE: just enter quit()

More examples of built-in modules you can run are:

  • python3 -m random
  • python3 -m platform
  • python3 -m tkinter

Not using a Package Manager?

If you’re not using a package manager, you’re probably very used to Windows and to dealing with the myriad of installers for all softwares out there.

Installers, installers, everywhere! (images courtesy of wikipedia.org, helpdeskgeek.com, froglogic.com, mariadb.com)

A package manager provides a single, consistent interface to install various softwares (for a single operating system).

Contrast that myriad of Windows installers with the single package manager used in various Unix-like operating systems: Advanced Package Tool (apt) for Ubuntu, DNF for Redhat and friends, Package Manager (pacman) for ArchLinux, etc.

Not using Homebrew?

Even if you’re using Linux, you have the option to use the same single, consistent interface that your MacOS friends use to install softwares.

Via Homebrew, Linux and MacOS can install softwares in the exact same way. We no longer have to answer “how to install X, Y, Z software” with a qualified “depends on your operating system” (situatedness).

Homebrew has become cross-platform across MacOS (the original target platform of Homebrew) and Linux (the original ecosystem of open-source programming tools).

Homebrew may mean you only deal with one package manager across multiple operating systems (MacOS and Linux, at least).

This cross-platform move (actually a “merge” between Homebrew and Linuxbrew) means a further convenience for you: you no longer have to deal with different package managers when working across MacOS and Linux.

(Technically, MacOS sort of “traditionally” uses MacPorts as a package manager. However, installing software via MacPorts could mean using more hard disk space. TODO: link to article discussing Ubuntu’s Snap package manager, which is kinda analogous to MacPorts.)

Not using MacOS?

You’ll either be using Linux or Windows.

Linux defines “free”

If you’re using Linux, you probably don’t need me telling you how to install software! However, using Linux on a laptop could mean you need to jump through hoops to get to the “It Just Works” state; and many laptops may never be fully compatible with Linux.

Linux may not fully support your hardware, just the most common and critical components (keyboard, mouse, display). Stay with the cheapest laptop possible for Linux, unless you’re somehow very certain that Linux fully supports all the fancy hardware features you intend to buy.

MacOS, in contrast, is specifically built to make full use of every shiny hardware feature that Apple builds into the MacBooks you buy.

Windows means “click here to play”

If you’re using Windows, you should understand that you’re quite far removed from the ecosystem of programming tools. Windows is a highly commercialized operating system that provides sleek user-interface (think: single click of a mouse) for a very specific activity: play!

Windows is optimized for play! However, with WSL2, Windows could competently double up as a programming tool as well.

If you’re looking to do some programming, you’ll find Windows provide scant few tools for tinkering. You may even find it hard to pop the hood open to dig deeper than “I’m just clicking my mouse and keyboard to play a game”. (TODO: link to article for MSYS2 and Windows 10’s WSL2.)

MacBooks are quite cost-effective; you get great, ergonomic hardware, and full access to the open-source ecosystem.

Linux is the original source and inspiration for that open-source ecosystem. Its price of zero pairs well with cheap/free hardware you can dig out from junkyards.

--

--

Jon Wong

Jon writes technology tutorials, fantasy (a dream), linguistics (phonology, etymologies, Chinese), gaming (in-depth playthrough-based game reviews).