System: Ubuntu20
Environment: python3.8
IDE: pycharm
After import xxxx
, it prompts no module namedxxxx
And this xxxx
is not a public package that can be directly pip installed, then we need to configure it manually
step
-
Open pycharm, open setting
Build, Executions, Deployment->Console->Python Console->check add source roots to PYTHONPATH
-
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
-
This should have solved the problem. If you still get an error, restart pycharm.
In fact, it is a question of environment variables.