使用PyDev-Eclipse和CDT-Eclipse创建Windows可执行文件(* .exe)-如何? [英] Creation of Windows executable file (*.exe) with PyDev-Eclipse and CDT-Eclipse --- How?

查看:113
本文介绍了使用PyDev-Eclipse和CDT-Eclipse创建Windows可执行文件(* .exe)-如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Eclipse工作台中为Python和C / C ++代码创建Windows可执行文件?如果是,那么该怎么办?

Is it possible to create Windows executable files for Python and C/C++ code within the Eclipse workbench? If yes, then how can this be done?

推荐答案

这就是我在Windows中从eclipse创建.exe文件的方式。不在Eclipse工作台中,但可能会对您有所帮助。为避免出现问题,即使您使用64位计算机,我也建议您以32位下载所有内容。

This is how I create .exe files from eclipse, in windows. Is not within the eclipse workbench but it might help you. To avoid problems, I would recommend to download everything for 32 bit even if you use 64 bit computer.

安装 python 2.6

安装 Eclipse

安装 py2exe

在Eclipse中,转到帮助>安装新软件,然后从 http://pydev.org/updates/

In eclipse go to Help > Install new software and install pydev plugin from http://pydev.org/updates/

在Windows首选项中,将python解释器指向python.exe的位置在您的计算机中(C:/ Python26)

In windows preferences point the python interpreter to the location of your python.exe in your computer (C:/Python26)

您可能需要将py2exe添加到库中

you might need to add py2exe to the libraries

创建一个名为setup.py的python模块,其代码与此类似:

create a python module called setup.py with a code similar to this one:

from distutils.core import setup
import py2exe

setup(windows=['H:/yourworkspace/YourPythonProject/src/yourprogram.py'])

打开Windows控制台并输入
python H:/ yourworkspace / YourPythonProject / src / setup.py py2exe

open windows console and type python H:/yourworkspace/YourPythonProject/src/setup.py py2exe

这将在C:/ Python26 / dist文件夹中创建一个.exe。如果您双击它,它应该可以工作,但是如果没有python或您使用的任何库,您都无法将其带到计算机上。为此,您可以使用 Inno设置

this will create a .exe located in C:/Python26/dist folder. It should work if you double click it but you cannot take it to a computer without python or any of the libraries that you´ve used. To do that, you can use Inno Setup.

它非常易于使用,基本上它会询问.exe的位置,您要添加的dll和文件夹(我对此一无所知,因此我将大多数内容添加到了C语言中:/ Python26 / dist,并且可以正常工作)。 Inno安装程序将创建一个脚本并生成一个.exe,您可以将其安装在任何计算机上。您可能需要编辑脚本的[Icons]部分

It's very easy to use, basically it will ask for the location of the .exe, the dlls and folders that you want to add (I don't know about this so I add most of the things inside my C:/Python26/dist and it works). Inno setup will create an script and generate a .exe that you can install in any computer. You might need to edit the [Icons] part of the script, I had problems with that before to add an icon to the application.

希望能正常工作,

好运。

这篇关于使用PyDev-Eclipse和CDT-Eclipse创建Windows可执行文件(* .exe)-如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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