PyCharm is a development editor for python developers. It is easy to use, yet it is effective. It comes up with two editions such as community edition and professional edition. Professional edition has more features and is very handy in the development of major python-based applications. Community edition has less features and is mostly used for learning purposes.
Install Snap Package
First, you need to install snap package, if you already do not have it, using the following command:
$ sudo apt install snapd
Now, update your repository before moving on to next step:
$ sudo apt update
Install Professional Edition
To Install professional edition, use the following command:
$ sudo snap install pycharm-professional --classic
Install Community Edition
To install community edition, use the following command:
$ sudo snap install pycharm-community --classic
Getting Started with PyCharm
After installation through terminal, click on the mentioned Apps icon:
Now, search for “PyCharm” in the dialog box, click on the PyCharm Icon:
You will see the PyCharm user agreement, tick the checkbox of “I accept that I have read and accept the terms of this User Agreement” and hit the continue button:
Take a look at the “Welcome to PyCharm” window. Here, click the New Project button with a “+” icon:
Next, you will see the “New Project” window, you can select the location of the project. Keep the “New environment using” as “Virtualenv”. Make sure you keep the base interpreter as python 3.9. Finally, if you want the main class to be created automatically then tick the “Create a main.py welcome script” checkbox. Click the “Create” button to create the project.
Next you will see a ‘main.py’ file in which there is a function with the name of ‘print_hi’ and it is written outside the main block of code. Then we have the main block of the code. Everything you write inside the main block, will be executed. ‘print_hi’ is called inside the main block, that’s why it’d be executed.
You can choose to run this program with the green triangle button or run button marked on the top right side of the screenshot below:
Let’s go ahead and write a new python program and run it.
We are going to remove the function and rest of the code except the main block. Now, Let’s write a print statement, then declare 2 variables and assign them values. We have written print statement again three times. In final line and last print statement, we added 2 variables and it’d print out the result.
In the end, let’s execute the program by hitting the green triangle button.
Now, you can see the output after running the python script named as ‘main.py’:
Congrats, you have installed PyCharm, written and run your first python script successfully using PyCharm.
PyCharm is an Integrated Development Environment (IDE) for python and is loved by the majority of python developers. We have taught to install both versions of this IDE in this tutorial. We created the project, written the code and ran the script to get results. PyCharm can be used to create advance applications and is certainly one of the best choices available for python developers.
The Best Linux Tutorials Website