Linux系统运行python脚本找不到文件问题
这是树结构,test.py里面引用hello.py,然后hello.py引用op.py。
这是hello.py的引用:
from hello.hello import add
c = add(1,2)
print(c)
python3 test.py
Traceback (most recent call last):
File "/home/jzz/test/test.py", line 2, in
from hello.hello import add
File "/home/jzz/test/hello/hello.py", line 2, in
import op
ModuleNotFoundError: No module named 'op'
hello.py里把import op
改为
from hello import op