Enroll in Selenium Training

Eager to get started with the Python. Why not? I had the same feeling when I was about to start it. Now, it's your turn to feel that excitement. Therefore, let's install Python on your PC. Additionally, we will cover the following sections in this tutorial.

  1. Install Python

    • Linux
    • Windows
    • Mac OS X
  2. Install IDLE

    • Linux
    • Windows
    • Mac OS X
  3. Install PyCharm Community Edition

    • Windows
    • Linux
    • Mac OS X
  4. Common Setup for PyCharm

Install Python

We need to install Python to start coding in it. It's open-source. So, we don't need to pay for anything. Therefore, let's see how to install it on your PC. We will see the installation guide for both Linux and Windows.

Install Python on Linux

Most probably, Linux distributions have already installed Python. As a result, you don't need to worry about the installation.

Check your Python version by typing the Python --version command in terminal. If you run the command then, it will return the Python version.

Python Version

Additionally, if your PC doesn't have Python installed in it, run the following command to install it.

  • sudo apt-get install python3.8

You can specify any version of the Python in the above command. But, here in this course, we are going to use python3.8. Enter the password to start the installation. In addition to this, make sure you have internet access for the terminal.

Python Install Command

It will take a little time to install Python.

Python Installation Process

We have to set the PATH variable to access it from any directory. To set it, run the following command.

  • export PATH="$PATH:/usr/bin/local/python3.8"

Linux Export Command

Now, check the release of the Python after installation. You have successfully installed the Python on your PC. Run the command python3.8 to start interactive mode. You have to type python3.8 in the terminal to get the interactive mode of Python. Moreover, we are going to change it as well in a moment.

Python3.8

We have to access the interactive shell with the command python but, it's not possible until we finish the following steps.

Firstly, create a file with the name .bash_aliases in the /home/ directory.

.bash_aliases File

.bash_aliases File

Secondly, open the file and paste the text alias python='/usr/bin/python3.8'.

File Text

Finally, go to the terminal and type python to access the interactive shell.

Python Command

That's it, and you're all good to go.

Install Python on Windows

Go to the Python Official website and download the file by clicking the Download Python [lastest version] button. I am highly recommending you to download the latest version of Python.

Install Python on Windows

Note: If we click on the download button, it will automatically download the latest python version .exe file.

Firstly, double click on the file to start the installation. A dialogue box will open as follows.

Installation

After that, leave the default option Install launcher for all users (recommended) to install it for all the users. Check the Add Python 3.8 to the PATH option to install it globally. After this, click on Install Now. Permit to install it when it asks.

Installation

Additionally, you can see the progress of the installation in the above picture.

Installation

Consequently, you have successfully installed the Python on your PC. Run the python command in command-line to start the interactive mode of Python.

Python Version

Set up Environment Variable for Python in Windows

In case if you get the error, 'python' is not recognized as an internal or external command, operable program, or batch file, it means the environment variable for Python is not correctly set.

Python Not Recognized Error

Follow the below steps to set the environment PATH for the Python.

  1. First, go to Local Disk (C:)/Users/YourComputerName/AppData/Local/Programs/Python/Python_Version/Scripts

Python Scripts Path

  1. Second, search for the Edit the system environment variables and open it.

Environment Variables

Environment Variables Window

  1. Thirdly, click on the Environment Variables, a new window will appear, as shown below.

Environment Variables Setup Window

  1. Fourthly, double click on the PATH.

Environment Variables Setup Window

  1. After that, click on the New button and paste the path you have copied earlier.

Path Entry

  1. Now, remove the Scripts at the end of the path and add again by clicking the New button.

  2. Finally, click OK for three windows. Now, you can run the Python in the command-line.

Install Python on Mac OS

If your Mac OS doesn't have Python installed, then follow the below procedure to install the latest version of Python.

  1. Firstly, go to the download page of the Python official website.

Install Python on Mac OS

  1. Secondly, click on the Mac OS X to go to the Python versions page.

Install Python on Mac OS

  1. Thirdly, click on the Latest Python 3 Release - Python 3.8.0 to go to the files download page.

Install Python on Mac OS

  1. Fourthly, scroll to the Files section. Click on the macOS 64-bit installer to download the file.

Install Python on Mac OS

  1. Finally, after the completion of the downloading, double click the .pkg to start the installation.

We are going to work with the Python3.8.0 in this course. So, confirm the Python version before moving. Consequently, run the command python --version to get the version of Python.

Install IDLE Integrated Development Environment (IDE)

IDLE is the Integrated Development Environment for Python. It is an IDE for Python. [Don't think much: IDE provides different types of features like coding, debugging, monitoring resources, etc.

Install IDLE on Windows

We don't have to install it separately for Windows. If you have Python installed on your PC, then it will have an IDLE as well. Moreover, Windows users don't worry about anything; stay calm. Search for the IDLE in the start menu and click it to open. It'll look as follows.

IDLE

Install IDLE on Linux

To check whether your Linux operating system has IDLE or not, run the idle command in terminal and hit ENTER.

IDLE Command

If you have IDLE installed in your Linux, then it will open a window as follows. That's the IDLE.

IDLE

Moreover, if you don't have installed IDLE in your Linux system, then run the following commands to install.

sudo apt-get update

Update Command

sudo apt-get install idle3

IDLE Install Command

Installation

Installation_2

Installation_3

Now, check the installation of the IDLE using the command idle.

Install IDLE on Mac OS X

You don't have to install IDLE separately. Open the terminal and type the command idle to open it.

Install IDLE on Mac OS X

That's it. Next, we are going to install the most popular IDE PyCharm for Python.

Install PyCharm for Python

PyCharm is a JetBrains IDE for Python. It's one of the most popular IDE for the Python. We are going to use the PyCharm IDE in this course. You can skip the installation process if you have PyCharm already on your PC.

Install PyCharm on Windows

  1. First, go to the PyCharm official page to download the package.

Installation_3

  1. Secondly, scroll down to the download section.

PyCharm Download Section

  1. Thirdly, choose the Windows(.exe) from the drop-down in the community section.

PyCharm Download Options

  1. Fourthly, click the download button.

  2. After downloading the file, double click it to start the installation process.

PyCharm Installation 1

  1. After this, click the Next button. You will see the following screen.

PyCharm_Installation_2

  1. Finally, select the installation folder. I recommend you to leave the default folder for installation. And click Next. In the next step, you will see installation options as follows.

PyCharm_Installation_3

  1. After that, select a 64-bit launcher for Desktop shortcut. Additionally, add launchers dir to the PATH for environment variable setup. And click Next.

PyCharm_Installation_4

  1. After that, click the Next button.

PyCharm_Installation_5

  1. Finally, click the Install button to start the installation.

PyCharm_Installation_6

  1. If it asks for the reboot, then restart the PC. And you finished the most boring part of the coding.

Install PyCharm on Linux for Python

  1. Firstly, go to the PyCharm official page to download the package.

PyCharm Home Page

  1. Secondly, scroll down to the download section.

PyCharm Download Section

  1. Thirdly, choose the Linux(.tar.gz) from the drop-down in the community section, and download will start automatically.

PyCharm Download Options

  1. After that, extract the .tar.gz file.

Extracting

  1. Open the extracted folder, and you will see a file called Install-Linux-tar.gz.txt. It contains instructions to install the PyCharm. Subsequently, you can follow those instructions or else follow the below steps.

PyCharm Folder

  1. After that, open the terminal and change the directory to the PyCharm folder. And run the below commands.
  • cd pycharm-community-2019.2.4
  • cd bin

Directory Changing

  1. Run the command ./pycharm.sh to open the PyCharm.

PyCharm Opening Command

  1. Consequently, you will see a window as follows.

First Time Window

  1. Follow the steps in the section Common Configuration for PyCharm.

  2. After configuring the PyCharm, complete the below steps to create Desktop Entry for PyCharm.

  3. After that, open the PyCharm from the terminal by running ./pycharm.sh command.

  4. At the bottom of the window, you will find a drop-down option called Configure. Click it.

Desktop Entry Option

  1. After that, click the Create Desktop Entry option from the drop-down list. It will open a window as below.

User Privileges

  1. Finally, check the box and click OK. And enter the password of the computer.

Password Entry

  1. That's it. You have created the PyCharm desktop entry successfully. Now, you can launch the PyCharm from the menu.

Desktop Entry

Install PyCharm on Mac OS X

  1. Firstly, go to the PyCharm official page to download the package.

PyCharm Home Page

  1. Secondly, scroll down to the download section.

PyCharm Download Section

  1. Thirdly, choose the mac(.dmg) from the drop-down in the community section, and download will start automatically.

PyCharm Download Options

  1. After downloading the .dmg file, double click it to begin the installation process.

  2. After that, drag the PyCharm into the Applications folder.

  3. Finally, go to the Applications folder and double click the PyCharm to open it. That's it. You have installed the PyCharm IDE.

Common Configuration for PyCharm

  1. Firstly, open the PyCharm to configure some settings before starting coding.

  2. One window will appear as follows.

PyCharm_Installation_7

  1. Secondly, select the Do not import settings option, which is the default one, and click the OK button.

  2. After that, in the next window, it asks to accept the license. Accept the license and click Continue.

PyCharm_Installation_8

  1. Select the theme for PyCharm and click the Next: Featured plugins button.

PyCharm_Installation_9

  1. Additionally, PyCharm will show you some featured plugins to install. Ignore them for now and click Start using PyCharm.

PyCharm_Installation_10

  1. Finally, you will get the following screen after completing all the steps.

Conclusively, you are now ready with the Python setup. Let's get into the action from the next tutorial.

What Next?

Phew! We have completed the most annoying part of the course. Now, you are all set to write your first Python program. We are going to use PyCharm throughout the course. Therefore, make sure that you have installed it. Additionally, if you are facing any problem in installing the Python or PyCharm, please let me know in the comment section.

Happy Coding :)

Python Basics
Python Basics
Previous Article
Python IDE
Python IDE
Next Article

Similar Articles

Feedback