Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in IntelliJ, showing "No module named xxx", but "xxx" is actually installed in my system

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.

like image 487
keypoint Avatar asked Jul 01 '16 17:07

keypoint


People also ask

How do I install and enable Python plugin in IntelliJ?

Press Ctrl+Alt+S , go to Plugins and inspect the Installed tab to ensure the plugin is enabled. Also make sure that the following prerequisites are met: Python SDK is downloaded and installed on your machine. The required framework SDKs are downloaded and installed on your machine.

How do I import a python module into IntelliJ?

To do so, open the terminal in IntelliJ and run the activate command. IntelliJ will complain that there is no module named bs4 . Move the cursor to this name and press Alt-Enter. There should be an option to install the module.


1 Answers

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.

like image 137
Vasco Avatar answered Oct 02 '22 02:10

Vasco