PyCharm doesn't recognise installed module

前端 未结 14 2235
闹比i
闹比i 2020-12-03 06:55

I\'m having trouble with using \'requests\' module on my Mac. I use python34 and I installed \'requests\' module via pip. I can verify this via running installation again an

相关标签:
14条回答
  • 2020-12-03 07:49

    This is because you have not selected two options while creating your project:- ** inherit global site packages ** make available to all projects Now you need to create a new project and don't forget to tick these two options while selecting project interpreter.

    0 讨论(0)
  • 2020-12-03 07:50

    In my case, using a pre-existing virtualenv did not work in the editor - all modules were marked as unresolved reference (running naturally works, as this is outside of the editor's config, just running an external process (not so easy for debugging)).
    Turns out PyCharm did not add the site-packages directory... the fix is to manually add it.

    Open File -> Settings -> Project Interpreter, pick "Show All..." (to edit the config) (1), pick your interpreter (2), and click "Show paths of selected interpreter" (3).

    In that screen, manually add the "site-packages" directory of the virtual environment (4) (I've added the "Lib" also, for a good measure); once done and saved, they will turn up in the interpreter paths.

    The other thing that won't hurt to do is select "Associate this virtual environment with the current project", in the interpreter's edit box.

    0 讨论(0)
提交回复
热议问题