6

How can I get IntelliJ IDEA to recognize common Python modules? IntelliJ IDEA is complaining "unresolved reference" on everything despite that I have added my virtual environment as a "Python interpreter" and invalidated caches. These (1)(2) related questions did not help resolve the issue.

unresolved reference Interpreter is setup

Atte Juvonen
  • 4,428
  • 6
  • 41
  • 81

3 Answers3

4

The errors are caused by wrong source roots configuration. Your project doesn't know where to locate the reference.

Add a new content root From the main menu, select File | Project Structure⌘; and click Project Settings | Modules.

Select the necessary module and then open the Sources tab in the right-hand part of the dialog.

Click Add Content Root and specify the folder that you want to add as a new content root.

The link is here.

IntelliJ support discussed the same issue at here.

Another stack overflow discussion is here.

JIANG
  • 1,451
  • 2
  • 16
  • 32
1

you can try this :

Project Structure -> SDKs -> "+" -> Python SDK

Project -> Project SDK -> Python 2.7.10 #Choose the python version that you want

Volshebnik
  • 86
  • 9
0

This fixed for me when I setup the Python interpreter again. Apparently the problem was that the Python SDK's classpath was empty.

soKira
  • 61
  • 1
  • 2