【问题标题】:generating compiled Tkinter python code生成编译的 Tkinter python 代码
【发布时间】:2010-11-30 22:10:27
【问题描述】:

我注意到在 python 中使用 Tkinter 创建 GUI 时,运行最终的 .py/.pyw 文件时,我没有看到 .pyc 文件。 我想将我的应用程序提供给某人以供个人使用,而不给他完整的源代码。 有没有强制解释器生成一个 pyc 文件,或者任何其他方式在不使用 py2exe 或 cxfreeze 或类似的东西的情况下只得到 python 字节码?

【问题讨论】:

    标签: python tkinter


    【解决方案1】:

    试试:

    import py_compile
    py_compile.compile(r'/path/to/your/file.py')
    

    【讨论】:

    • 或者一行:python -c "import py_compile; py_compile.compile(r'/path/to/your/file.py')"
    • 无论如何要让这个工作与 pyw 的?也就是编译成pyc,还是去掉命令窗口?
    猜你喜欢
    • 2015-07-05
    • 1970-01-01
    • 2015-12-13
    • 1970-01-01
    • 2018-03-29
    • 2017-01-27
    • 1970-01-01
    • 1970-01-01
    • 2020-07-27
    相关资源
    最近更新 更多