>>> from foo.bar import app
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named foo.bar
我的目錄結構:Python的 - 導入錯誤:沒有模塊名爲foo.bar
In /foo:
__init__.py
bar.py
In /foo/tests:
__init__.py
testing.py
在/foo/tests/testing.py
我需要從/foo/bar.py
導入應用程序。如果我運行testing.py文件,我得到ImportError
。
我檢查了sys.path
和/foo
和/foo/tests
文件夾包括在內。