假设你的文件结构如下: - main.py - my_module/ - __init__.py - my_submodule.py - other_module/ - module1.py - module2.py 现在我需要在my_submodule.py里引入other_module目录下的module1文件,做法如下: import sys sys.path.append('..') # 将上一级目录添加到Python的模块搜索路径 from other_module import module1