How do I configure a Python interpreter in IntelliJ IDEA with the PyCharm plugin?

PythonIntellij Idea

Python Problem Overview


There is a tutorial in the IDEA docs on how to add a Python interpreter in PyCharm, which involves accessing the "Project Interpreter" page. Even after installing the Python plugin, I don't see that setting anywhere.

Am I missing something obvious?

Python Solutions


Solution 1 - Python

With the Python plugin installed:

  1. Navigate to File > Project Structure.
  2. Under the Project menu for Project SDK, select "New" and
  3. Select "Python SDK", then select "Local".

Provided you have a Python SDK installed, the flow should be natural from there - navigate to the location your Python installation lives.

Solution 2 - Python

So here is a simple project, where I have used Selenium and added that using external path

Error

Now you need to open Project Structure and go to SDK Section

Project Structure

Now Select your project's virtual environment. In the Classpath tab add the PYTHONPATH by clicking + button

Add SDK

and now the modules will be recognized

Module recognized

Solution 3 - Python

I was getting the error (IntelliJ on Ubuntu 18.04) while python SDK was configured.

To fix that, I had to do this:

  1. File -> Project Structure -> Modules

  2. Click on the Dependencies tab, and click on + and select the python SDK

    enter image description here

  3. Click on Apply

After that, the warning went away and autocompletion also started working properly

Solution 4 - Python

If you have multiple modules in your project, with different languages, you can set the interpreter in the following way:

  • File -> Project Structure...
  • Select Modules in the list on the left
  • Select the Python module in the list of modules
  • On the right-hand side, either choose an existing Python SDK from the dropdown list, or click on the New... button to create either a virtualenv, or create a new Python SDK from a Python installation on your system.

Solution 5 - Python

Follow these steps:

  1. Open Setting (Ctrl + Alt + s)
  2. Click on plugins
  3. Find Browse Repositories and click
  4. Search for "python"
  5. Select Python SDK or pycharm
  6. Restart the IDE
  7. Go to project structure
  8. Select the python SDK in projects or create a new project with python SDK.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkousenView Question on Stackoverflow
Solution 1 - PythonMakotoView Answer on Stackoverflow
Solution 2 - PythonTarun LalwaniView Answer on Stackoverflow
Solution 3 - PythonJunaidView Answer on Stackoverflow
Solution 4 - PythonZoltánView Answer on Stackoverflow
Solution 5 - PythonPrakashView Answer on Stackoverflow