python cx_freeze problem ascil

匿名 (未验证) 提交于 2019-12-03 02:29:01

问题:

I want to make EXE file by use py2exe or cx_freeze.

so I was try to make exe file with py2exe but no luck.

so now I was test with cx_freeze but it also failed.

if anyone can help me much apprecaite

following is setup.py file in cx_freeze from cx_Freeze import setup, Executable

copyDependentFiles=True silent = True includes = ["lxml", "lxml._elementpath", "lxml.etree", "gzip", "encodings.cp949", "encodings.utf_8", "encodings.ascii"] setup(name='gearfacts',       options = {        "build_exe" : {            "includes": includes,            },        },      executables=[Executable('test.py')],      ) 

following is my script source file.

-- coding: utf-8 --

回答1:

The Python code you have posted is actually incorrect - if this is the actual code that you are trying to freeze - then you probably get an error along the lines of

  File "cx_freeze_test.py", line 35     for line in os.popen("ipconfig /all"):                                          ^ IndentationError: unindent does not match any outer indentation level

I suggest you start with a very simple script, e.g.

print "hello"

Then you should get an error something like:

  File "C:\_tools\python2.7.0\lib\site-packages\cx_Freeze\freezer.py", line 632, in __init__     parts = version.split(".") AttributeError: 'NoneType' object has no attribute 'split'

You can see that it is trying to split the version string on '.'. But you have not defined a version in your setup.py.

So... adding that

from cx_Freeze import setup, Executable  copyDependentFiles=True silent = True includes = ["lxml", "lxml._elementpath", "lxml.etree", "gzip", "encodings.cp949", "encodings.utf_8", "encodings.ascii"] setup(name='gearfacts',      version = "1.1",      options = {        "build_exe" : {            "includes": includes,            },        },      executables=[Executable('cx_freeze_test.py')],  ) 

I end up with an EXE that can run after this.



转载请标明出处:python cx_freeze problem ascil
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!