从 python 代码为 windows 创建独立的可执行文件 [英] creating stand-alone executable for windows from python code

查看:56
本文介绍了从 python 代码为 windows 创建独立的可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 pygkt、gtk、ctypes、os 和其他一些模块的 python 代码.我使用 pyinstaller 创建了一个独立的代码执行程序.它在 ubuntu 上运行良好.现在我想为 windows 平台创建另一个独立的执行程序.我使用了工具 https://github.com/paulfurley/python-windows-packager并按照步骤操作.但我收到错误:找不到模块 gtk.如何解决问题?是否有其他工具可以将 python 代码转换为 Windows 操作系统的独立可执行文件?如果是,请提供详细信息?谢谢

I have a python code which uses the pygkt, gtk, ctypes, os and some other modules. I used pyinstaller to create a stand-alone executive of the code. It worked fine on ubuntu. Now I wanted to create another stand-alone executive for windows platform. I used the tool https://github.com/paulfurley/python-windows-packager for it and followed the steps. But I got the error: module gtk not found. How to fix the issue ? Are there any other tools to convert python code to stand-alone executable for windows os ? If yes, please provide the details ? Thank you

推荐答案

我建议使用 pyinstaller

示例:

$ pip install pyinstaller
$ pyinstaller -F myscript.py

您现在应该有一个 build/myscript/myscript.exe 可执行文件.

You should now have a build/myscript/myscript.exe executable.

这篇关于从 python 代码为 windows 创建独立的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆