PyCharm does not recognize modules installed in development mode

后端 未结 8 1505
猫巷女王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.

提交回复
热议问题