PyCharm doesn't recognise installed module

前端 未结 14 2284
闹比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:48

    This issue arises when the package you're using was installed outside of the environment (Anaconda or virtualenv, for example). In order to have PyCharm recognize packages installed outside of your particular environment, execute the following steps:

    Go to

    Preferences -> Project -> Project Interpreter -> 3 dots -> Show All -> Select relevant interpreter -> click on tree icon Show paths for the selected interpreter

    Now check what paths are available and add the path that points to the package installation directory outside of your environment to the interpreter paths.

    To find a package location use:

    $ pip show gym
    Name: gym
    Version: 0.13.0
    Summary: The OpenAI Gym: A toolkit for developing and comparing your reinforcement learning agents.
    Home-page: https://github.com/openai/gym
    Author: OpenAI
    Author-email: gym@openai.com
    License: UNKNOWN
    Location: /usr/local/lib/python3.7/site-packages
    ...
    

    Add the path specified under Location to the interpreter paths, here

    /usr/local/lib/python3.7/site-packages

    Then, let indexing finish and perhaps additionally reopen your project.

提交回复
热议问题