我在Python3上有一个小应用程序,但它不会运行,因为找不到模块。我已经为所有文件夹添加了__init__.py
,但它不起作用。我想知道为什么。Makefile在Python3中找不到模块
这里是我的结构
my_project
|- __init__.py
|
|-- folder
|-code.py
|- __init__.py
|
|-- Makefile
|-- scripts
|- import_data.py
,这里是我的Makefile
test:
py.test tests/*.py
create_graph:
python scripts/import_data.py
这是我的import_data.py
from folder.code import method
import csv
method()
# doing something here
当我运行make create_graph
它给了我这个。
python scripts/import_data.py
Traceback (most recent call last):
File "scripts/import_data.py", line 1, in <module>
from folder.code import method
ImportError: No module named 'folder'
make: *** [create_graph] Error 1