【发布时间】:2021-10-19 20:23:50
【问题描述】:
我有一个使用 scikit-build 构建的 C 扩展(因为它使用 CMake 库),并且在导入 python 时构建良好并且可以工作。
然后我尝试构建使用带有 cx-freeze 的扩展的脚本,该扩展正在构建中,但我看到“缺少模块”下列出的扩展:
Missing modules:
? _atscManufacturing imported from atsc.atscManufacturing.atscManufacturing
当我从命令提示符运行构建的可执行文件时,它只会挂起几秒钟,然后退出而没有输出。
我见过this solution,它建议使用Extension 添加C 扩展,但这似乎是要编译库而不是仅仅包括编译后的库。我认为这不会起作用,因为它需要构建 CMake 库。
这是我的主要setup.py:
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os", "atsc.atscManufacturing.atscManufacturing", "intelhex", "logging", "atexit", "sys"], "excludes": []}
base = None
setup( name = "Manufacturing script",
version = "1.0.0",
description = "manufacturing script",
options = {"build_exe": build_exe_options},
executables = [Executable("main.py", base = base)])
这是./atsc 扩展中的setup.py:
from skbuild import setup
setup(
name="atscManufacturing",
version="0.1",
packages=['atscManufacturing']
)
【问题讨论】:
标签: python windows cx-freeze scikit-build