Close

Python with Intellij

[Last Updated: Feb 1, 2022]

In this tutorial we will learn how to use Intellij to write python programs.

Installing Python

Install the latest python as stated in this tutorial.

Using Intellij IDE

In this tutorials we are using Intellij community version.

Create a folder "python-hello-world". Open this folder in intellij as project: File > Open > python-hello-world folder

Installing Python plugin

Open Intellij setting dialogs: CTRL + ALT + S > Plugins, search for 'python'. Install Python Community Edition. This is PyCharm community plugin, PyCharm professional version (not free) provides additional features. For learning purpose community edition is enough.

Click on install.

Selecting Python interpreter

Open project structure dialog (CTRL + SHIFT + ALT + S) and select python SDK (specify python.exe location)

venv folder

Once we have selected Python interpreter, Intellij will create venv folder. This folder is Python specific and is created by a tool called virtualenv.
This folder is created to have a project-specific isolated virtual environment.
This folder contains the Python executable files which is necessary to install other packages and manage settings.

Writing Python code

Create a folder scripts and add new file hello-word.py:

scripts/hello-world.py

print("hello world from python!")

Running

In Intellij, we can run Python script by accessing right click menu:

Output

hello world from phyton!

Example Project

Dependencies and Technologies Used:

  • Python 3.10.2
Python hello world Select All Download
  • python-hello-world
    • scripts
      • hello-world.py

    See Also