简体   繁体   English

构建时出现cx-freeze错误

[英]cx-freeze error on build

I keep getting this error when trying to do a build on Win 7 64bit: 尝试在Win 7 64bit上进行构建时,我一直收到此错误:

C:\Users\Tom>python C:\Users\Tom\Documents\setup.py build
running build
running build_exe
copying C:\Users\Tom\Anaconda\lib\site-packages\cx_Freeze\bases\Win32GUI.exe ->
build\exe.win32-2.7\NJM_GUI.exe
copying C:\Users\Tom\Anaconda\python27.dll -> build\exe.win32-2.7\python27.dll
Stamped: build\exe.win32-2.7\NJM_GUI.exe
Traceback (most recent call last):
File "C:\Users\Tom\Documents\setup.py", line 29, in <module>
executables=executables
File "C:\Users\Tom\Anaconda\lib\site-packages\cx_Freeze\dist.py", line 362, in
setup
distutils.core.setup(**attrs)
File "C:\Users\Tom\Anaconda\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Users\Tom\Anaconda\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Users\Tom\Anaconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Users\Tom\Anaconda\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Users\Tom\Anaconda\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Users\Tom\Anaconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Users\Tom\Anaconda\lib\site-packages\cx_Freeze\dist.py", line 232, in
run
freezer.Freeze()
File "C:\Users\Tom\Anaconda\lib\site-packages\cx_Freeze\freezer.py", line 610,
in Freeze
self.compress, self.copyDependentFiles)
File "C:\Users\Tom\Anaconda\lib\site-packages\cx_Freeze\freezer.py", line 510,
in _WriteModules
module.Create(finder)
File "C:\Users\Tom\Anaconda\lib\site-packages\cx_Freeze\freezer.py", line 746,
in Create
module.file, module.name)
cx_Freeze.freezer.ConfigError: no file named sys (for module boto.compat.sys)

my setup.py file looks like: 我的setup.py文件如下所示:

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == 'win32':
base = 'Win32GUI'

options = {
    'build_exe': {
        'includes': 'atexit'
    }
}

executables = [
    Executable('C:\Users\Tom\Documents\NJM_GUI.py', base=base)
]

setup(name='simple_PyQt4',
  version='0.1',
  description='Sample cx_Freeze PyQt4 script',
  options=options,
  executables=executables
  )

I do use numpy and pandas in my app as well as pyqt but not sure what the issue is here or how to resolve it? 我在我的应用程序和pyqt中都使用了numpy和pandas,但不确定问题出在哪里或如何解决?

Thanks. 谢谢。

The full detailed answer is at cx_freeze fails to create exe with pandas library . 完整的详细答案是在cx_freeze无法使用pandas库创建exe

The short version is exclude the following files: 简短版本不包括以下文件:

'build_exe': {
    'excludes': ['boto.compat.sys',
                 'boto.compat._sre',
                 'boto.compat._json',
                 'boto.compat._locale',
                 'boto.compat._struct',
                 'boto.compat.array'],
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM