当前位置: 动力学知识库 > 问答 > 编程问答 >

python 2.7 - Cannot build script with cx_freeze

问题描述:

By now I've tried just about everything from py2app to cx_freeze attempting to make my script distributable. I'm to the point where it will build the app in cx_freeze but it simply crashes immediately when I try to run the app. I'm using Anaconda w/Python 2.7. I'm not sure if this is part of the issue or not. When I attempted to freeze the script the first few times it would tell me that Anaconda/tcl does not exist in the traceback. So I went into the Anaconda directory, found folders with tcl8.5 wx and tk and copied them from lib to the Anaconda directory. Now it does build the app but the traceback gives a lot of these .tcl is not a Mach-O file.

:error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: input file: build/SSD-Single Subject Designs-1.0.app/Contents/MacOS/tk/ttk/xpTheme.tcl is not a Mach-O file

The odd thing is I can't even get a simple "hello world" script to freeze and run successfully. It crashes in the same way.

Here's the setup file I'm using:

import cx_Freeze

from cx_Freeze import setup, Executable

import matplotlib

import sys

base = None

if sys.platform == "win32":

base = "Win32GUI"

executables = [

cx_Freeze.Executable("FirstProduction.py", base = base)]

build_exe_options = {

'includes' : ['numpy', 'pandas', 'itertools', 'os', 'wx', 'csv', 'gspread'],

'packages' : ['matplotlib.backends.backend_wxagg'],

'excludes' : ['boto.compat.sys',

'boto.compat._sre',

'boto.compat._json','boto.compat._locale','boto.compat._struct','boto.compat.array','PyQt4'],

'include_files' : [(matplotlib.get_data_path(), "mpl-data")]

}

setup(

name = "SSD-Single Subject Designs",

version = "1.0",

description = "Single-Subject Graphing",

options = {'build_exe': build_exe_options},

executables = executables)

Any insight would be fantastic. As you can see from the setup file I'm using the wx matplotlib backend, along with quite a few different modules. I can upload my script if anyone would be willing to try to build it themselves.

分享给朋友:
您可能感兴趣的文章:
随机阅读: