Skip to content Skip to sidebar Skip to footer

Python: Systemerror Parent Module Not Loaded, Cannot Perform Relative Import

I know there are already a lot of questions similar to this one but unfortunately I haven't found out how to apply to my problem. The structure of my project is as follows: Project

Solution 1:

If you just want to run that module and not the whole Package. Do python -m maincode.bin.train which tells python to run it as a module.

If you want to run the whole package then change directory into the Project: cd /path/to/project then run: python maincode and if your code is set up correctly it should run train.py.

Otherwise, move the script outside of the Package and run it on it's own.

More on this and understanding Packages can be found here: Relative imports for the billionth time

Solution 2:

Files in the same directory can only use the "import module" and cannot use the "from" keyword, for unknown reasons

Post a Comment for "Python: Systemerror Parent Module Not Loaded, Cannot Perform Relative Import"