10

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,922
  • 7
  • 46
  • 89

3 Answers3

6

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,687
  • 2
  • 19
  • 36
2

you can try this :

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

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

v015h3bn1k
  • 98
  • 11
1

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

soKira
  • 71
  • 1
  • 2