在python中导入两个包之间

时间:2014-08-23 18:49:36

标签: python packages importerror python-import

我正在处理的项目中有两个软件包(他们都在项目根目录中): enter image description here

main.py包中的room模块需要从speechtotext包中导入一些模块。所以我在main.py中的导入看起来像from speechtotext.<modlue> import <something>。我一直为这些跨包导入获得ImportError

如何修复导入以使其正常工作?

1 个答案:

答案 0 :(得分:0)

../speechtotext的路径添加到PYTHONPATH envar,或者只将speechtotext移动到会议室文件夹中。并且不要忘记在speechtotext中制作__init__.py文件。

相关问题