bkoodaa
bkoodaa

Reputation: 5322

IntelliJ IDEA says "unresolved reference" on everything (Python, virtual environment)

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

Upvotes: 18

Views: 23105

Answers (3)

soKira
soKira

Reputation: 81

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

Upvotes: 2

JIANG
JIANG

Reputation: 1877

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.

Upvotes: 13

v015h3bn1k
v015h3bn1k

Reputation: 98

you can try this :

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

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

Upvotes: 2

Related Questions