在进入全速开发模式之前,我正在玩一些基本的东西在Python中工作.以下是具体内容:
Python 2.5.4 PyQt4 4.4.3 SqlAlchemy 0.5.2 py2exe 0.6.9 setuptools 0.6c9 pysqlite 2.5.1
setup.py:
from distutils.core import setup import py2exe setup(windows=[{"script" : "main.py"}], options={"py2exe" : {"includes" : ["sip", "PyQt4.QtSql","sqlite3"],"packages":["sqlite3",]}})
py2exe似乎正确生成.exe文件,但是当我执行dist/main.exe时,我在main.exe.log中得到了这个
Traceback (most recent call last): File "main.py", line 18, inFile "main.py", line 14, in main File "db\manager.pyc", line 12, in __init__ File "sqlalchemy\engine\__init__.pyc", line 223, in create_engine File "sqlalchemy\engine\strategies.pyc", line 48, in create File "sqlalchemy\engine\url.pyc", line 91, in get_dialect ImportError: No module named sqlite
我一直在谷歌上搜索,但似乎无法找到任何解决方案.如果我现在无法使用它,我希望在这个项目中使用Python将会破灭,我将重新开始使用Ruby ...(不是说Ruby有什么问题,我只是想把这个项目用作自学Python的好方法)
您需要包含sqlalchemy.databases.sqlite包
setup( windows=[{"script" : "main.py"}], options={"py2exe" : { "includes": ["sip", "PyQt4.QtSql"], "packages": ["sqlalchemy.databases.sqlite"] }})
你需要改变sqlalchemy.dialects.sqlite包
设置程序(窗口= [{ "脚本": "main.py"}],选项= { "py2exe":{ "包括":[ "SIP", "PyQt4.QtSql"], "包":["SQLAlchemy的. dialects.sqlite"]}})