py2exe

python: Can I run a python script without actually installing python?

邮差的信 提交于 2019-11-27 01:30:05
问题 I have some .py files I wrote that I want to run on a different machine. The target machine does not have python installed, and I can't 'install' it by policy. What I can do is copy files over, run my stuff, and then remove them. What I tried was to just take my development python folder over to the target machine and cd to the python folder and run python.exe /path/to/.py/file . It gave me an error saying that python.dll was not registered. If I registered the DLL that is probably going to

multiprocessing.freeze_support()

喜欢而已 提交于 2019-11-27 01:17:46
问题 Why does the multiprocessing module need to call a specific function to work when being "frozen" to produce a windows executable? 回答1: The reason is lack of fork() on Windows (which is not entirely true). Because of this, on Windows the fork is simulated by creating a new process in which code, which on Linux is being run in child process, is being run. As the code is to be run in technically unrelated process, it has to be delivered there before it can be run. The way it's being delivered is

Py2exe lxml woes

半城伤御伤魂 提交于 2019-11-27 00:54:58
问题 I have a wxpython application that depends on lxml and works well when running it through the python interpreter. However, when creating an exe with py2exe, I got this error ImportError: No module named _elementpath I then used python setup.py py2exe -p lxml and I did not get the above error but another one saying ImportError: No module named gzip Could anyone let me know what the problem is and how I can fix it. Also should I put any dll files like libxml2, libxslt etc in my dist folder? I

py2exe fails to generate an executable

一个人想着一个人 提交于 2019-11-27 00:13:29
I am using python 2.6 on XP. I have just installed py2exe, and I can successfully create a simple hello.exe from a hello.py. However, when I try using py2exe on my real program, py2exe produces a few information messages but fails to generate anything in the dist folder. My setup.py looks like this: from distutils.core import setup import py2exe setup(console=['ServerManager.py']) and the py2exe output looks like this: python setup.py py2exe running py2exe creating C:\DevSource\Scripts\ServerManager\build creating C:\DevSource\Scripts\ServerManager\build\bdist.win32 ... ... creating C:

Py2exe - win32api.pyc ImportError DLL load failed

妖精的绣舞 提交于 2019-11-26 22:51:31
问题 I am trying to use py2exe to distribute a python application I have written. Everything seems to go OK, but when I run it on another machine it fails with the following error: Traceback (most recent call last): File "application.py", line 12, in <module> File "win32api.pyc", line 12, in <module> File "win32api.pyc", line 10, in __load ImportError: DLL load failed: The specified procedure could not be found. I have googled for this and not found very much, but have tried the following

How would I combine multiple .py files into one .exe with Py2Exe

那年仲夏 提交于 2019-11-26 21:45:46
问题 I used PyQt to make a GUI for my program, but it has multiple .py files, 2 are them are classes, and one launches the code. So I was wondering, how would I combine them into one whole program? Here is a download link to all the .py files I will be combining: http://www.multiupload.com/CJDL639CTH 回答1: Shed Skin can turn your program into a fast executable, but maybe that doesn't work for your program. With py2exe and a setup.py like this you can easily turn your Python 2.x code in Windows into

Py2exe: Embed static files in exe file itself and access them

走远了吗. 提交于 2019-11-26 21:17:24
问题 I found a solution to add files in library.zip via: Extend py2exe to copy files to the zipfile where pkg_resources can load them. I can access to my file when library.zip is not include the exe. I add a file : text.txt in directory: foo/media in library.zip. And I use this code: import pkg_resources import zipfile from cStringIO import StringIO my_data = pkg_resources.resource_string(__name__,"library.zip") filezip = StringIO(my_data) zip = zipfile.ZipFile(filezip) data = zip.read("foo/media

Relative import error with py2exe

女生的网名这么多〃 提交于 2019-11-26 18:32:04
问题 I was trying to generate an executable for a simple Python script. My setup.py code looks like this: from distutils.core import setup import py2exe setup(console=["script.py"]) However, I am getting the error shown in the screenshot. Is there something I could try to fix this? I am using Windows 10. 回答1: It seems that in your mf3.py you are importing beyond the top level. Let's suppose that your project structure is as follows: folder/ main.py mod/ __init__.py components/ __init__.py expander

Python py2exe[转]

流过昼夜 提交于 2019-11-26 18:16:49
一、简介 py2exe是一个将python脚本转换成windows上的可独立执行的可执行程序(*.exe)的工具,这样,你就可以不用装python而在windows系统上运行这个可执行程序。 py2exe已经被用于创建wxPython,Tkinter,Pmw,PyGTK,pygame,win32com client和server,和其它的独立程序。py2exe是发布在开源许可证下的。 二、安装py2exe 从 http://prdownloads.sourceforge.net/py2exe 下载并运行与你所安装的Python对应的py2exe版本的installer,这将安装py2exe和相应的例子;这些例子被安装在lib\site-packages\py2exe\samples目录下。 三、py2exe的用法 如果你有一个名为myscript.py的python脚本,你想把它转换为运行在windows上的可执行程序,并运行在没有安装python的windows系统上,那么首先你应写一个用于发布程序的设置脚本例如mysetup.py,在其中的setup函数前插入语句import py2exe 。 mysetup.py示例如下: # mysetup.py from distutils.core import setup import py2exe setup(console=[

Python py2exe window showing (tkinter)

喜夏-厌秋 提交于 2019-11-26 17:52:17
问题 I'm trying to make an exe by py2exe. The program is showing a popup-like window using Tkinter. The problem is, everything works fine when I run the setup like this: setup(windows = [{'script': "msg.py"}], zipfile = None) but it fails when I try to make an one-file exe: setup(windows = [{'script': "msg.py"}], zipfile = None, options = {'py2exe': {'bundle_files': 1, 'compressed': True}}) Actually the final exe runs without problems, but it doesn't display any window. I've read there may be