如何为使用pyInstaller,py2exe或类似工具创建的独立可执行文件创建一个好的插件引擎?
我没有使用py2exe的经验,但是pyInstaller使用导入钩子从它的压缩存储库导入包.当然,我能够动态导入另一个用pyInstaller创建的压缩存储库并执行代码 - 这可能是一个简单的插件引擎.
当插件(这是动态导入的)使用原始存储库中不存在的库(从未导入)时出现问题.这是因为import hook用于原始应用程序并在原始存储库中搜索包 - 而不是稍后导入的包(插件包存储库).
有没有简单的方法来解决这个问题?也许存在这样的引擎?
我通常不是Windows用户,但我需要从我的python代码构建exe,所以我想使用py2exe来做到这一点.我有一个XP系统,我安装了python 2.6.6.我下载了py2exe-0.6.9源代码,但是当我尝试安装(通过"python setup.py install")时,我收到错误"无法找到vcvarsall.bat".我一派,碰上了这个帖子,其中一个受访者建议可安装MinGW的GCC二进制文件的定制版本在这里.我这样做了,现在当我尝试安装py2exe时,我收到了一个新错误.这是输出:
C:\Documents and Settings\Administrator\Desktop\py2exe-0.6.9>python setup.py install
C:\Documents and Settings\Administrator\Desktop\py2exe-0.6.9\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated
import sets
running install
running build
running build_py
running build_ext
building '_memimporter' extension
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
creating build\temp.win32-2.6\Release\source
c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DPYTHONDLL=\"PYTHON26.DLL\" -DPYTHONCOM=\"pythoncom26.dll\" -IC:\Python26\include -IC:\Python26\PC -c source/MemoryModule.c -o build\temp.win32-2.6\Release\source\memorymodule.o
source/MemoryModule.c:30: warning: ignoring #pragma warning
source/MemoryModule.c: In function 'BuildImportTable':
source/MemoryModule.c:364: warning: pointer targets in passing argument 1 of 'MyLoadLibrary' differ in signedness
source/MemoryModule.c: In function 'GetNameTable': …Run Code Online (Sandbox Code Playgroud) 我有一个基于Twisted和PyGTK的Python应用程序.扭曲本身取决于zope.interface,我不直接导入它.
不幸的是,当我尝试运行我的应用程序时,错误日志中会出现以下错误:
Traceback (most recent call last):
File "tasks.py", line 4, in <module>
File "ui\__init__.pyc", line 14, in <module>
File "twisted\python\log.pyc", line 17, in <module>
ImportError: No module named zope.interface
Traceback (most recent call last):
File "tasks.py", line 4, in <module>
File "ui\__init__.pyc", line 14, in <module>
File "twisted\python\log.pyc", line 17, in <module>
ImportError: No module named zope.interface
Traceback (most recent call last):
File "tasks.py", line 4, in <module>
File "ui\__init__.pyc", line 14, in <module>
File "twisted\python\log.pyc", line 17, in …Run Code Online (Sandbox Code Playgroud) 我想从使用命令行参数的python脚本创建一个exe(argv)
从我看到的py2exe不支持命令行参数
我能做什么?
编辑:我使用的是GUI2Exe工具,所以我只是错过了控制台标志,但接受的答案是完全正确的
我正在使用并行python使用称为OrcFxAPI的模块运行多个动态仿真。如果该程序作为python程序在我的计算机上运行,则该程序运行完美,但是如果我使用py2exe将其转换为exe文件,然后运行,则会收到以下错误消息:
Traceback (most recent call last):
File "Analysis.pyc", Line 500, in multiprocessor
File "pp.pyc", Line 342, in __init__
File "pp.pyc", Line 506, in set_ncpus
File "pp.pyc", Line 140, in __init__
File "pp.pyc", Line 152, in start
File "pptransport.pyc", Line 140, in receive
RuntimeError: Communication pipe read error
Run Code Online (Sandbox Code Playgroud)
我的程序在这一行失败了:
job_server = pp.Server(ppservers=ppservers)
Run Code Online (Sandbox Code Playgroud)
但我认为这可能与提交作业时用于导入OrcFxAPI模块的路径有关:
job = job_server.submit(max_seastate, (gui_vars, case_list, case, line_info, output_vars), (), ("OrcFxAPI",), callback=finished, callbackargs=(case_no, no_of_cases,))
Run Code Online (Sandbox Code Playgroud) 我正在使用py2exe将我的脚本编译成一个在Windows上运行的exe文件,但是我的操作系统是基于我的操作系统,即Window 7 x64.我使用以下命令在cmd中运行以下脚本execmaker.py py2exe:
from distutils.core import setup
import py2exe
includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = []
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll']
setup(
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 1,
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['My_Script.py'] #this is the name of the script I'm compiling to exe
Run Code Online (Sandbox Code Playgroud)
) …
我一直在研究,但需要一些专门针对Py2exe应用程序的建议.我在64位机器上,但据我所知,我可以用32位格式编译,并在32位和64位上运行.
现在我的问题.要制作一个exe,我正在使用py2exe.所以从我的理解,你不需要一个32位环境,只需一个32位编译器,这意味着32位Py2exe?所以,如果我删除Py2exe并重新安装32位版本的py2exe,它将同时运行?我还需要采取其他预防措施吗?
非常感谢.
我正在尝试在没有安装python的系统上运行python文件.我正在使用py2exe,它给了我一个在我的系统上正常运行的.pyc文件,但是当我把它交给没有python的朋友时,它告诉他Windows无法运行该文件.
我的setup.py文件包含这个;
from distutils.core import setup
import py2exe
setup(console=['PyVersionControl.py'])
Run Code Online (Sandbox Code Playgroud)
当我在命令行中运行py2exe时,这是输出
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\chdick>python setup.py py2exe
running py2exe
3 missing Modules
------------------
? readline imported from cmd, code, pdb
? win32api imported from platform
? win32con imported from platform
Building 'dist\PyVersionControl.exe'.
Building shared code archive 'dist\library.zip'.
Copy c:\windows\system32\python34.dll to dist
Copy C:\Python34\DLLs\pyexpat.pyd to dist\pyexpat.pyd
Copy C:\Python34\DLLs\_ctypes.pyd to dist\_ctypes.pyd
Copy C:\Python34\DLLs\unicodedata.pyd to dist\unicodedata.pyd
Copy C:\Python34\DLLs\_hashlib.pyd to dist\_hashlib.pyd
Copy C:\Python34\DLLs\_socket.pyd to …Run Code Online (Sandbox Code Playgroud) 我知道这是一个非常大的问题,但我会尽量让它变得简单.
假设我example.py只持有以下代码:
def xsum(a,b):
return a+b
Run Code Online (Sandbox Code Playgroud)
我怎么能把它封装到一个可以调用的DLL中,而不需要在最终用户计算机上安装python.我的目标是在VBA中使用它.
我看了py2exe创建一个.exe但我找不到一个DLL的解决方案.任何帮助,将不胜感激.我使用python 3.6
我在Windows 10上使用Py2exe创建了一个.exe文件但是当我尝试在Windows 7计算机上运行它时,它说os版本是错误的.
谁能告诉我如何解决这个问题?(比如使用另一个Python或Py2exe版本或在setup.py中设置特定配置)
py2exe ×10
python ×10
windows ×2
32bit-64bit ×1
64-bit ×1
compilation ×1
dll ×1
plugins ×1
pygtk ×1
pyinstaller ×1
twisted ×1
vba ×1