System error: parent module “not loaded, can not perform relative import when importing Python package
When using flash for web development, the structure of the project is reset as follows:
write the picture description here
when running the project again, the system error: parent module “not loaded, cannot perform relative import will appear. Through the error location, it is found that the problem is caused by the packet guidance.
from .app import create_ app
The “parent module” is not loaded and cannot be imported. Why is there such a problem
by viewing the project structure, use
from web_ flask.app import create_ app
At this time, there are more package guiding problems
write the picture description here
first locate yourself in views.py and delete the package guiding statement
from .models import Users
Then, use the local guide
from web_ Flash. App. Models import users
User = users (1 ‘sun’)
so far, the problem has been solved
or you can add the corresponding Python path with sys.path.append
to solve the problem———————
Read More:
- [Solved] SystemError: Parent module ” not loaded, cannot perform relative import
- [Solved] Python Relative Reference Error: ImportError: attempted relative import with no known parent package
- Python 3 uses the relative path import module
- [Solved] Python Project Import Module Error: ModuleNotFoundError
- Solution for Python3.7 import gevent module error
- Keras import package error: importerror: cannot import name ‘get_ config‘
- [Mac Pro M1] Python3.9 import cv2 Error: Reason: image not found
- [Solved] OpenCV Import Error: ImportError: numpy.core.multiarray failed to import
- [Solved] From pip._internal import cmdoptions ImportError: cannot import name SourceDistribution
- Raspberry pie import opencv error: ImportError: numpy.core.multiarray failed to import
- [Solved] import pyzed No Error, but import pyzed.sl report an Error (zed-pythonAPI Installing)
- How to Solve Python ImportError: cannot import name UnrewindableBodyError
- Python failed to import pyx file [How to Solve]
- [Solved] Python 3.7 from collections import Iterable Error
- [Solved] python3.10 Error: cannot import name ‘Iterable‘ from ‘collections‘
- Solve the problem of error reporting from scipy.misc import imread & imresize in Python
- [Solved] pycharm Import New Project Error: cannot set up a python sdk
- from keras.preprocessing.text import Tokenizer error: AttributeError: module ‘tensorflow.compat.v2‘ has..
- How to Solve Python Pandas Read or Import Files Error
- Python ImportError: numpy.core.multiarray failed to import