我想用一个平台不可知论者来运行cx\u freeze设置.py我不知道如何将编译后的文件(.pym,.so)添加到可执行文件中
DataProcessor是Cython在外部编译的python模块。。。但是我不知道如何在cx\u中包含它,因为绝对路径取决于plataform和python版本。那我该怎么处理呢。你知道吗
编译了可执行文件,但没有包含外部模块,因此当我运行应用程序时,会抛出一个错误,即没有加载DLL,或者在MacOS中显示ModuleNotFoundError: No module named 'DataProcessor'
编辑:我在原稿上看到一个错误设置.py,更正此错误cx\u freeze显示此错误
cx_Freeze.freezer.ConfigError: cannot find file/directory named DataProcessor
EDIT2:根据@mgracer的建议,他试图放入includes部分,但没有成功的cx\u冻结显示
ImportError: No module named 'DataProcessor'
我该怎么做才能保持我的健康呢设置.pyplataform不可知论者。你知道吗
这就是我现在所拥有的
from Cython.Build import cythonize
from cx_Freeze import setup, Executable
import sys
import os.path
# Windows hack
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
# Windows hack
includes = []
excludes = ['tkinter']
packages = ['openpyxl', 'sqlite3', 're', 'collections', 'os']
include_files = ['DataProcessor']
dll_excludes = []
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {
"excludes": excludes,
"includes": includes,
"packages": packages,
"include_files": include_files
}
setup(
name="analizador",
version="0.1",
description="Foo bar",
options={"build_exe": build_exe_options},
ext_modules=cythonize("DataProcessor.pyx"),
executables=[Executable("analisis.py", base=base)]
)
我把问题解决了设置.py脚本 结果是:
相关问题 更多 >
编程相关推荐