I'm using Python 3.2 32bit with sqlalchemy installed. I have written quite simple script in Python using sqlalchemy. I'm importing it like that:
from sqlalchemy import *
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
The script is working correctly. I want to make .exe with cx_freeze
. So i wrote following setup.py
file:
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "dev_db",
version = "1.0",
description = "Device Database System",
options = {"build_exe": build_exe_options},
executables = [Executable("./dev_db/db_main/db_init.py", base=base)])
(The application is part of bigger package containing other applications)
After launching setup.py build
everything goes fine except:
? sqlalchemy imported from db_init__main__, dev_db.common.alchemy_base, dev_db.common.devinfo_io, dev_db.common.event_io
? sqlalchemy.engine.reflection imported from db_init__main__
? sqlalchemy.ext.declarative imported from dev_db.common.alchemy_base, dev_db.common.event_io
? sqlalchemy.ext.hybrid imported from dev_db.common.devinfo_io, dev_db.common.event_io
? sqlalchemy.orm imported from db_init__main__, dev_db.common.alchemy_base, dev_db.common.devinfo_io
The .exe is created but it won't work-it seems that cx_freeze cannot see the sqlalchemy which is obviously installed!
Any help would be very appreciated.
cx_Freeze appears to have some problems with packages installed as eggs (possibly where the egg is a zip file). Open the folder or zip file ending in .egg
, and copy the package - the sqlalchemy
folder in this case - up one level into the site-packages
directory. Then re-freeze it, and cx_Freeze should find the package.