How do I use installed packages in PyCharm?

后端 未结 13 1451
暗喜
暗喜 2020-11-22 16:20

In PyCharm, I\'ve added the Python environment /usr/bin/python. However,

from gnuradio import gr

fails as an unde

13条回答
  •  失恋的感觉
    2020-11-22 16:39

    Adding a Path

    Go into File → Settings → Project Settings → Project Interpreter.

    Then press configure interpreter, and navigate to the "Paths" tab.

    pycharm path tab

    Press the + button in the Paths area. You can put the path to the module you'd like it to recognize.

    But I don't know the path..

    Open the python interpreter where you can import the module.

    >> import gnuradio
    >> gnuradio.__file__
    "path/to/gnuradio"
    

    Most commonly you'll have a folder structure like this:

    foobarbaz/
      gnuradio/
        __init__.py
        other_file.py
    

    You want to add foobarbaz to the path here.

提交回复
热议问题