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.pyprint("hello world from python!")
Running
In Intellij, we can run Python script by accessing right click menu:
Outputhello world from phyton!
Example ProjectDependencies and Technologies Used: |