py2exe

Having py2exe include my data files (like include_package_data)

江枫思渺然 提交于 2019-12-01 05:46:12
问题 I have a Python app which includes non-Python data files in some of its subpackages. I've been using the include_package_data option in my setup.py to include all these files automatically when making distributions. It works well. Now I'm starting to use py2exe. I expected it to see that I have include_package_data=True and to include all the files. But it doesn't. It puts only my Python files in the library.zip , so my app doesn't work. How do I make py2exe include my data files? 回答1: I

Py2exe with Tkinter

别等时光非礼了梦想. 提交于 2019-12-01 05:37:26
问题 I'm trying to convert a basic tkinter GUI program to an .exe using py2exe. However I've run into an error using the following conversion script. # C:\Python26\test_hello_con.py py2exe from distutils.core import setup import py2exe setup(windows=[r'C:\Python26\py2exe_test_tk.py']) C:\Python26\py2exe_test_tk.py is the following code import Tkinter as tk root = tk.Tk() root.title("Test") label1 = tk.Label(root,text="Hello!",font=('arial', 10, 'bold'), bg='lightblue') label1.pack(ipadx=100, ipady

Compiling python code into a single exe

雨燕双飞 提交于 2019-12-01 05:12:06
问题 I've been trying to compile python code into a single exe, and i didn't manage to do it correctly. I've tried pyinstaller, and this is the .spec file: # -*- mode: python -*- a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'programs\\toolbox.py'], pathex=['C:\\Users\\Ronaldo\\Desktop\\Python\\pyinstaller']) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name=os.path.join('dist', 'program.exe'), debug

“maximum recursion depth exceeded” while packaging py file with py2exe

自闭症网瘾萝莉.ら 提交于 2019-12-01 04:04:26
问题 The py2exe worked quite well on the same py file several months ago. But when I tried it again today it failed by reporting a “RuntimeError: maximum recursion depth exceeded”. I got an empty “dist” folder as a result. The Py file works normally, it just can't be packaged. I guess there is something wrong with the imported modules in the py file. But I can not figure it out exactly. Does any one know the solution? The begining part of my py file is: import xlrd import wx import wx.lib

Is there a way to specify the build directory for py2exe

孤街醉人 提交于 2019-12-01 03:17:41
I can set the final dist directory of py2exe using the command line: python setup.py py2exe -d "my/dist/dir" but I can't seem to set the file to use for the interim build directory. I've taken a brief look at the source, but unless I am missing something there doesn't appear to be any way to do it. Any option that you can set on the command line you can set either through a setup.cfg file or in your setup.py file. -d is a shortcut for --dist-dir which you can add to the py2xe dict in the dictionary passed to the options keyword param of setup as 'dist_dir' : from distutils.core import setup

Access denied using Py2exe

旧时模样 提交于 2019-12-01 03:10:18
I'm using Py2exe to create an executable as a windows service. When I run the script I get this error: File "C:\TeamCity\buildAgent\work\582d895bd5b431ac\winpython\WinPython-32bit-2.7.3.3\python-2.7.3\lib\site-packages\py2exe\build_exe.py", line 860, in build_executable add_resource(ensure_unicode(exe_path), script_bytes, u"PYTHONSCRIPT", 1, True) RuntimeError: EndUpdateResource: Access is denied. This is the call to py2exe: setup( name = NAME, description = DESCRIPTION, version = '1.0.133.43', service = [{'modules':["ServiceLauncher"], 'cmdline':'pywin32'}], zipfile=None, options = { "py2exe"

Access denied using Py2exe

社会主义新天地 提交于 2019-12-01 00:02:33
问题 I'm using Py2exe to create an executable as a windows service. When I run the script I get this error: File "C:\TeamCity\buildAgent\work\582d895bd5b431ac\winpython\WinPython-32bit-2.7.3.3\python-2.7.3\lib\site-packages\py2exe\build_exe.py", line 860, in build_executable add_resource(ensure_unicode(exe_path), script_bytes, u"PYTHONSCRIPT", 1, True) RuntimeError: EndUpdateResource: Access is denied. This is the call to py2exe: setup( name = NAME, description = DESCRIPTION, version = '1.0.133.43

Python脚本打包为exe文件

岁酱吖の 提交于 2019-11-30 22:22:39
把Python脚本和所用到的库打包为exe文件,可以更方便的发布程序,避免使用程序的每个电脑都必须安装Python。 网上有不少相关介绍,但很少见到Python 3.x下打包Python脚本为exe的成功案例,笔者探索了一下,成功完成了任务,记录下来分享给需要的朋友。欢迎交流。 一、Python 3.1的打包办法 1、下载cx_Freeze。 http://sourceforge.net/projects/cx-freeze/files/ 根据自己的系统类型和Python版本下载合适的类型,我下载的是:cx_Freeze-4.1.2.win32-py3.1.msi。 这个工具目前最新版本是2010.1.6号的,还挺新的。 2、安装。 直接安装下载的安装包。 之后可以看到cxfreeze工具所在目录如下: 3、打包。 我要打包的是BlogPost.py和它依赖的模块。 A、准备工作。 a、去除代码中所有中文字符,包括注释。(指定编码的注释可以不去掉没有关系) b、 如果用到类似lxml这样的第三方库,可能会出现找不到_elementpath模块的错误。需要在某个.py文件中写上import _elementpath as DONTUSE,并且指定该模块的搜索路径。(我的该模块所在路径是:C:\Python25\Lib\site-packages\lxml \_elementpath

Can't make standalone binary scrapy spider with cx_Freeze

混江龙づ霸主 提交于 2019-11-30 21:49:46
A short description about my working environment: win 7 x64, python 2.7 x64, scrapy 0.22, cx_Freeze 4.3.2. First, I developed a simple crawl-spider and it works fine. Then, using the core scrapy API, I created an external script main.py, which can run spider, and it also works as required. Here is the code of the script: # external main.py using scrapy core API, 'test' is just replaced name of my project from twisted.internet import reactor from scrapy.crawler import Crawler from scrapy import log, signals from test.spiders.testSpider import TestSpider from test import settings, pipelines from

Bundling GTK3+ with py2exe

随声附和 提交于 2019-11-30 21:31:07
Platform is Windows 7 64bit using python 2.7 and GTK3+ installed from http://sourceforge.net/projects/pygobjectwin32/files/?source=navbar The exe is compiled but fails to run, due to this The following modules appear to be missing ['gi.repository.Gdk', 'gi.repository.Gtk', 'overrides.registry'] How can i properly include these files? imports in my .py file from gi.repository import Gtk, Gdk my setup file #!/usr/bin/env python from distutils.core import setup import py2exe, sys sys.path.append("C:\Python27\Lib\site-packages\gnome") sys.path.append("C:\Python27\Lib\site-packages\repository")