This guide will show you how to create a Python virtual environment on Intellij IDEA and activate it on Intellij’s terminal.
We first need to make a Python interpreter available so we can use it in our virtual environment, so let’s install it with pyenv.
Run the command below to print a list of available Python versions.
pyenv install --list Available versions: 2.1.3 2.2.3 ... 3.10.5
For this example, I copied the version 3.10.5
so I can now install it:
pyenv install 3.10.5
Now open your project on Intellij and right click on your project name in the Project tab -> Open Module Settings. Then, select the SDK tab:
Next, click on the plus “+” button and select Add Python SDK…
There are a few settings we need to change in the new window that opened. First, make sure you selected the tab “Virtualenv Environment” and edit the following fields as described:
<your_project_path>/venv
<your_home_folder>/.pyenv/versions/3.10.5/bin/python
Your setting should look similar to below:
Then. click on Apply.
Now, on the same window, go to the Project tab, and assign the newly created virtual environment as the SDK:
Click OK to close the dialog.
To confirm everything worked, you should see your Intellij IDEA terminal prefixed with (venv)
when you open a new terminal tab:
This guide will show you how to create a Python function decorator with a few…
This guide will show you how to fix the error Got permission denied while trying…
This tutorial will quickly show you how to to find and kill processes on Linux,…
This guide shows a possible solution for Python error Relocation R_X86_64_PC32 against symbol can not…
I condensed below a cheat sheet of Kubernetes useful commands. I will keep updating this…
This tutorial will show how to create aliases for commands on Unix based systems, so…