Python Environment Setup: Getting Started

Python runs on several platforms or operating systems (OS). Those are Windows, Linux, etc. But the way of installation and setting environment variables are different for various platforms. Here we will demonstrate how to set the environment in Python. To check Python is installed or not in the system, we have to go to the command window and type ‘python’. If it shows that Python is not a command then Python is not installed in the system but if it shows Python with the version number then Python is already installed in the system.

Getting Started

Python is freely available on its official website ( Anyone can download it but we have to make sure about the OS. Python documentation is also available on the same website with several formats like HTML file, PDF file, etc.

Python Installation

Users have to download the binary code application based on their OS then they can go for installation. Users need a C compiler for compiling the source code if they are not getting the binary code that is suitable for their OS. Now we will demonstrate how to install Python in various OS.

In Windows:

Step 1: Go to the website

Step 2: Install the Windows installer python-XYZ.msi file.

Step 3: Save the file into the system and run it.

Step 4: Run the downloaded file (Have to wait until the installation is done).

In Linux:

Step 1: Go to the website

Step 2: Download the zipped source code for Linux or UNIX.

Step 3: Extract files.

Step 4: Edit modules and configure scripts.

Step 5: Make and make install.

PATH Settings

For executing Python codes, OS needs some permission to form various dictionaries of the system. It can be done by setting up the PATH and stored in an environment variable. It maintains the OS and holds the command shell and other program information. It also depends on various platforms. Those are given below

For Windows:

  • Open the command prompt and type the PATH (%path%;C:\Python) then press Enter.
  • %path%;C:\Python is the Python download path

For Linux:

  • Open terminal and type export PATH="$PATH:/usr/local/bin/python" then press Enter.
  • /usr/local/bin/python is the path where Python is downloaded

Python Environment Variables

Python has 4 environment variables. Those are PYTHONPATH, PYTHONSTARTUP, PYTHONCASEOK, and PYTHONHOME. PYTHONPATH is the same as the PATH. It contains the Python source library directory. It can be present by the Python installer. PYTHONSTARTUP holds the path of an initialization file and commands that load conveniences of PATH. PYTHONCASEOK is used to identify the first case-insensitive match. To make it active, we have to assign a value to it. PYTHONHOME is an alternative to PYTHONPATH. It is used to make switch module libraries easily.

Python IDE

IDE stands for Integrated Development Environment and it is an editor where programmers will write their code. It is a GUI environment to run the code. UNIX has IDLE as an IDE. Windows has PythonWin as an IDE. Before starting code, it is necessary to validate that the Python environment is correctly set up and working perfectly or not. Otherwise, the user has to take help from their system admin. Python has two realized versions: python2 and python3.