如何编译python脚本到二进制可执行文件 [英] How to compile python script to binary executable

查看:848
本文介绍了如何编译python脚本到二进制可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将python脚本转换为windows可执行文件。



我已经在我的系统中安装了 python 2.6



我可以在c驱动器命名python26中看到一个包含所有文件的文件夹。



脚本并将其保存在此文件夹中的 C:\pythonscript



中有两个文件



Setup.py oldlogs.py (此文件需要转换) / p>

setup.py 代码

  from distutils.core import setup 
import py2exe

setup(console = ['oldlogs.py'])

现在请让我知道我应该如何进行,以便我可以将oldlogs.py转换为exe。

解决方案

或使用 PyInstaller 替代 py2exe 。以下是一个很好的起点。 PyInstaller让你也为linux和mac ...创建可执行文件...


I have to convert python script to windows executable.

I have installed python 2.6 in my system.

I can see a folder in c drive naming python26 which contain all the files.

I have created one script and kept it in C:\pythonscript

inside this folder there are two files

Setup.py and oldlogs.py (this file need coversion)

setup.py code is

from distutils.core import setup
import py2exe

setup(console=['oldlogs.py'])

Now please let me know how should i proceed so that i can convert oldlogs.py to exe.

解决方案

Or use PyInstaller as an alternative to py2exe. Here is a good starting point. PyInstaller let's you also create executables for linux and mac...

这篇关于如何编译python脚本到二进制可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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