Here is the current directory setup:
dir_a:
__init__.py
one.py
two.py
Here is one.py:
from dir_a.two import TwoClass
From inside dir_a, running
"python -m pdb one.py"
"ModuleNotFoundError: No module named 'dir_a'"
From inside pdb, I've tried appending the absolute path to dir_a, but still having trouble finding and being able to import my Two class.
Two options:
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
import sys; sys.path.append('[dir containing dir_a]')
import sys; sys.path.append('[dir containing dir_a]')
Don't add the dir_a
path itself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.