Pycharm adds a custom python package -- no module named xxxx solution

System: Ubuntu20
Environment: python3.8
IDE: pycharm

After import xxxx, it prompts no module namedxxxx

And this xxxxis not a public package that can be directly pip installed, then we need to configure it manually

step

  1. Open pycharm, open setting
    Build, Executions, Deployment->Console->Python Console->check add source roots to PYTHONPATH
    insert image description here

  2. File->Settsing->Project->Project structure->Select the directory of the resource package, right-click to add to Sources, then click apply, click ok, the path we just added appears in the add content Root on the right
    insert image description here

  3. This should have solved the problem. If you still get an error, restart pycharm.

In fact, it is a question of environment variables.

Guess you like

Origin blog.csdn.net/qq_41159191/article/details/130325850