Contact me: hankecnc@gmail.com

在没有任何库的情况下将 bCNC 转换为 exe 安装文件 #437

推推 grbl 3年前 (2023-02-01) 272次浏览
关闭
MohamadAlsadi 打开了这个问题 2016 年 9 月 23 日 · 30条评论
关闭

在没有任何库的情况下将 bCNC 转换为 exe 安装文件#437

MohamadAlsadi 打开了这个问题 2016 年 9 月 23 日 · 30条评论

注释

在没有任何库的情况下将 bCNC 转换为 exe 安装文件 #437
穆罕默德阿尔萨迪 评论了 2016 年 9 月 23 日  

没有提供说明。

在没有任何库的情况下将 bCNC 转换为 exe 安装文件 #437
贡献者

你好 @MohamadAlsadi,

试试这个:
在 bCNC.py 中更改此行

PRGPATH=os.path.abspath(os.path.dirname(__file__))

有了这个

if getattr(sys, 'frozen', False):
    # frozen
    PRGPATH=os.path.abspath(os.path.dirname(sys.executable))
else:
    # unfrozen
    PRGPATH=os.path.abspath(os.path.dirname(__file__))

通过这种方式,我可以构建一个非常好的 exe,它看起来可以工作,并且可以添加到发行版中。

这是我的 setup.py

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "bCNC",
        version = "0.1",
        description = "Grbl sender and more",
        options = {"build_exe": build_exe_options},
        executables = [Executable("bCNC.py", base=base)])

然后我运行python setup.py build
将 dist 文件夹中的所有内容复制到主文件夹以访问图形资源等。

让我们了解您的测试。

在没有任何库的情况下将 bCNC 转换为 exe 安装文件 #437
贡献者
人魔 评论了 2016 年 9 月 23 日  

这里是@MohamadAlsadi
只需解压并运行 bCNC.exe
在 Win10(使用 python 和其他东西)和 WinXp(干净的机器)上测试。
通过测试我的意思是它开始……现在不能尝试使用机器。

bCNC4Win.zip

在没有任何库的情况下将 bCNC 转换为 exe 安装文件 #437

好的谢谢@effer
这是工作