我有一个具有以下目录结构的 Python 2.5 项目:
database/__init__.py
database/createDBConnection.py
gui/mainwindow.py
当我尝试跑步时
python gui/mainwindow.py
我得到错误
C:\PopGen>python gui/mainwindow.py
Traceback (most recent call last):
File "gui/mainwindow.py", line 12, in <module>
from database.createDBConnection import createDBC
ImportError: No module named database.createDBConnection
在 mainwindow.py 中,第 12 行有以下语句
from database.createDBConnection import createDBC
出现问题是因为 Python 找不到数据库模块。
问题:我该怎么做才能修复此错误?
这是项目的代码:https ://www.dropbox.com/sh/edfutlba960atp9/MwFpaepEpl
我试着用
C:\PopGen>python -m gui.mainwindow
但得到了这些错误
Traceback (most recent call last):
File "C:\Python25\lib\runpy.py", line 95, in run_module
filename, loader, alter_sys)
File "C:\Python25\lib\runpy.py", line 52, in _run_module_code
mod_name, mod_fname, mod_loader)
File "C:\Python25\lib\runpy.py", line 32, in _run_code
exec code in run_globals
File "C:\PopGen\gui\mainwindow.py", line 13, in <module>
from file_menu.wizard_window_validate import Wizard
ImportError: No module named file_menu.wizard_window_validate