Python Setup – Windows, MAC and Linux, Python Basics | First Python Script

This post explains about Python Setup on different OS like Windows, MAC & Linux. We will also learn about Python basics like commenting, PIP, PY charm and first Python script. Let us start step by step.

Python Setup on your machine

Python Setup on Windows

  1. Go to download python page on official site
    https://www.python.org/downloads/
  2. Click on Download python 3.6.4 (Version may change) and complete the download
  3. Double click on downloaded file. It will launch the python installer. Follow the instructions and you will see “The installation was successful” message when Python is successfully installed.

Python Setup on Mac OS

  1. Go to download python page on official site
    https://www.python.org/downloads/
  2. Click on Mac OS X below section “Looking for Python with a different OS? Python for Windows”
  3. Click on Mac OS X 64-bit/32-bit installer (Version may change) and complete the download
  4. Double click on downloaded file. It will launch the python installer. Follow the instructions and you will see “The installation was successful” message when Python is successfully installed.

Python Setup on Ubuntu

Python 3 is installed by default on modern versions of Ubuntu, so you should already have it installed. On command line run:

You should see current installed version of Python on your machine.

Introduction to PyCharm

By now you have successfully installed Python on your machine by following steps in previous section.

Now you need a good text editor to make and run your scripts. Windows installer of python comes with a default text editor called “IDLE”. You can surely use it but I personally prefer a text editor called PyCharm.

PyCharm can be used from making a small script to large professional application.

Go ahead, download and install PyCharm. We will soon use it to make our first script.

Basics of PIP command line

As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for other Python developers to use under open source license terms.

This allows Python users to share and collaborate effectively, benefiting from the solutions others have already created to common problems, as well as potentially contributing their own solutions to the common pool.

PIP is the preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers.

Open a command prompt or shell prompt depending on the OS you are using and type

If python is installed correctly on your machine, then it should list all available commands for pip.

Let’s say you want to install Requests library to make http calls. Open command line and type:

Successful completion of this command will install request library in your PC. You can now import and use it in your scripts.

Hands On

Culture of indentation

Python functions have no explicit begin or end, and no curly braces to mark where the function code starts and stops.

We will discuss the syntax details later, here I just want to show you that unlike other languages python does not use brackets to mark the begin and end of a statement.

It uses “:” and indentation to show that we are in a code block.

These indentations will be automatically added by your python supported text editors. Advantage of this approach is, you will always get a well-structured code in the end.

How to comment in Python

It is a good practice to put comment in our program to make it more understandable.

Comments in the program are the statements which will not be executed. These are the pointers for the developer, that what a certain piece of code is supposed to do.

Python provides two types of commenting methods:

Single line comment in Python using hash (#)

Multiline comment in Python

Say hello to world (Make your first script)

OK let’s start with our first script.

Open PyCharm and click on File->New -> Then select python file -> Name your file like first_prog.py.

“py” extension indicates that it’s a python script.

Now write code as shown below and save it.

Run this program by pressing the Run button. You should see Hello World on output prompt.

That’s it, this is all about Python basics and first Python program

Team RCV Academy

About Manish Verma

RCV Academy Team is a group of professionals working in various industries and contributing to tutorials on the website and other channels.

View all posts by Manish Verma