目录结构:
-- src
|-- mod1.py
|-- mod2
| |-- mod2.py
|-- sub
| |-- test2.py
|-- test1.py
test2.py 中导入模块 mod2 的调用方式如下:
import sys
sys.path.append("..")
from mod2.mod2 import *
运行后报错:
Traceback (most recent call last):
File "test2.py", line 3, in <module>
from mod2.mod2 import *
ImportError: No module named mod2
python 版本 2.6.6
找了一些资料没有查到跟我一样的问题,求大家帮忙看下是哪里的问题,多谢。
-- src
|-- mod1.py
|-- mod2
| |-- mod2.py
|-- sub
| |-- test2.py
|-- test1.py
test2.py 中导入模块 mod2 的调用方式如下:
import sys
sys.path.append("..")
from mod2.mod2 import *
运行后报错:
Traceback (most recent call last):
File "test2.py", line 3, in <module>
from mod2.mod2 import *
ImportError: No module named mod2
python 版本 2.6.6
找了一些资料没有查到跟我一样的问题,求大家帮忙看下是哪里的问题,多谢。