6

My IntelliJ version is 15.0.3, and have python plugin installed.

And when I open a python file in IntelliJ it's like below enter image description here

Situation here is like below:

  1. when I import these flagged modules in terminal, everything works fine.
  2. running this python file in IntelliJ, is also fine

It's only the red underlying warning annoying me.

I tried this one, this one and this one, but none works for me.

Could anyone please tell me how to get rid of it? Thanks a lot.

Community
  • 1
  • 1
keypoint
  • 2,119
  • 4
  • 27
  • 55

2 Answers2

6

You have to add the site-packages path of your interpreter.

For that you have to:

  1. go to Project Structure
  2. choose Global Libraries
  3. choose your Python interpreter
  4. press + at the upper left corner
  5. choose the site-package path of your interpreter
  6. choose "Classes"

also add your python interpreter root directory in the same way.

Vasco
  • 355
  • 2
  • 13
0

I have similar problems: cannot import manually installed module. I try to add classpath in Mac environment parameters and intellij SDKs, but it doesn't work. My final solution is to add the classpath of the module to Run/Debug Configurations:

Open Run/Debug Configurations and select your unittest class:

Run --> Edit Configurations...

Add your module's classpath to Environment variables: enter image description here

Pingjiang Li
  • 667
  • 1
  • 12
  • 24