【发布时间】:2013-12-28 03:07:06
【问题描述】:
我的包结构是:
主文件 地图/ __init__.py 核/ __init__.py tobeimported.py 测试/ __init__.py (测试模块) 实用程序/ __init__.py blasttofasta.py文件blasttofasta.py作为脚本执行。
blasttofasta.py 看起来像:
import mapp.core.tobeimported
def somefunc():
pass
if __name__ == '__main__':
pass
但出现异常:
Traceback (most recent call last):
File "utils/blasttofasta.py", line 5, in <module>
import mapp.core.tobeimported
ImportError: No module named mapp.core.analyzers
如何导入tobeimported模块?我从顶层目录(main.py 所在的位置)运行blasttofasta.py
编辑:也许更好的问题是:如何将 mapp 包放入 sys.path?因为脚本文件只看到自己的目录,看不到包目录。
谢谢
【问题讨论】:
-
python -m mapp.utils.test
标签: python