Course Three - Python language Environment

Python language Environment

By ienex


Python is a versatile programming language available on all major operating systems, including Linux, macOS, and Windows. Before you start coding, it’s important to set up a local Python environment on your device.


Supported Platforms

Python can be installed on a wide variety of platforms, including:

  • Unix-based systems: Solaris, Linux, FreeBSD, AIX, HP/UX, SunOS, IRIX

  • Windows: Windows 9x, NT, 2000, Windows CE

  • macOS: Intel, PPC, 68K

  • Other systems: OS/2, DOS, PalmOS, Nokia mobile phones, Acorn/RISC OS, BeOS, Amiga, VMS/OpenVMS, QNX, VxWorks, Psion

To check if Python is already installed, open a terminal or command prompt and type:

python

This will display the installed Python version, if any.


Downloading Python

The official Python website, python.org, provides:

  • Source code

  • Binaries for different operating systems

  • Documentation in HTML and PDF

Download the version appropriate for your system. If a precompiled binary is unavailable, you can compile Python from source, which gives more flexibility and control over installation options.


Installing Python

On Unix/Linux

  1. Open your web browser and go to python.org/download.

  2. Download the source code for Unix/Linux.

  3. Optionally, modify installation modules to customize settings.

  4. Run the installation commands in the terminal.

After installation, Python libraries are typically stored in:

/usr/local/lib/pythonXX

where XX represents your Python version.


On Windows

  1. Go to python.org/download and select the Windows installer (.msi) for your version.

  2. Ensure your system supports Microsoft Installer (MSI).

  3. Run the downloaded .msi file and follow the prompts.

  4. Accept default settings for a standard installation.


On macOS

macOS usually comes with Python preinstalled, but it may be outdated. To get the latest version:

  1. Visit python.org/download/mac.

  2. Follow the instructions to download and install the current version.

  3. Additional tools may be required for development.

For troubleshooting or installation help on macOS, see MacPython Guide.


Setting the PATH Environment Variable

To run Python from any terminal or command prompt, you need to add Python to your system PATH.

On Unix/Linux

  • csh shell:

setenv PATH "$PATH:/usr/local/bin/python"
  • bash shell (Linux):

export PATH="$PATH:/usr/local/bin/python"
  • sh or ksh shell:

PATH="$PATH:/usr/local/bin/python"

Note: /usr/local/bin/python should be replaced with the actual path of your Python installation.

On Windows

  1. Open the Command Prompt.

  2. Enter the following:

set PATH=%PATH%;C:\Python

Note: Replace C:\Python with your actual Python installation directory.

Once the PATH is set, you can run Python from any terminal window without specifying the full path.


Python’s cross-platform availability and easy installation process make it simple to get started, whether you are on Windows, macOS, or Linux.

Comments

Popular posts from this blog

Why You Should Learn JavaScript and Python in 2025

Why you Should Learn JavaScript and Python ?

Course Six - Operators in Python