PyCharm does not recognize modules installed in development mode

后端 未结 8 1504
猫巷女王i
猫巷女王i 2020-12-14 00:37

I have two pure python projects in PyCharm 3.4.1 Professional Edition. The first one, let\'s call it p (like package), is structured as a setuptools package (i.

相关标签:
8条回答
  • 2020-12-14 01:22

    I had a devil of a time getting PyCharm to recognize a class in a module that I had just written.

    The problem is that PyCharm seems to default to not importing module class paths, which requires two separate fixes to correct.

    Step 1

    Right click on the module name, and mark it as "Source":

    Step 2

    For some reason, by default in PyCharm, it does not actually add directories marked as "Sources Root" to the Python path. Fix this by switching this on.

    Extra for experts

    Notice the "Starting Script" in the image above. I assume that manually adding these lines to your Python script would also achieve the same result.

    Tested On

    • Windows 10 x64.
    • PyCharm Community Edition 2017.2.3.
    0 讨论(0)
  • 2020-12-14 01:22

    Sort of workaround that worked for me:

    Open both projects in PyCharm in the same window (workspace). Now open up the settings window, and under "Project -> Project Depencies" you can now select that project s depends on project p. Imports and autocompletion will now work fine.

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