gcc编译python可执行_如何运行Nuitka编译的Python可执行文件

我正在Ubuntu 14.04上试验Nuitka并尝试创建并运行可执行文件.我有一个文件hello.py与内容

print("Hello please")

我使用命令nuitka hello.py将其转换为hello.exe.但是,当我尝试使用Wine 1.7运行它时,我得到以下错误:

$wine hello.exe

wine: Bad EXE format for Z:\home\crclayton\hello.exe.

我认为这是Nuitka的问题,而不是Wine,因为我可以使用Wine来运行我在C#中创建的helloworld.exe.有谁知道如何修理它?

编辑:

我在Ubuntu上没有运气,所以我测试了我的Windows 7分区上的hello.exe(Ubuntu和Windows都是64位),我收到以下错误:

The version of this file is not compatible with the version of windows you’re running. Check your computer’s system information to see whether you need an x86 (32 bit) or x64 (64 bit) version of the program, and then contact the software publisher.

问题是Nuitka正在创建一个32位的exe并且我试图在64位操作系统上运行它吗?如果是这样,任何人都知道如何解决它?

解决方法:

根据Nuitka手册

The resulting filename will be program.exe on all platforms, that doesn’t mean it doesn’t run on non-Windows! But if you compile program we wouldn’t want to overwrite it, or be unsure which one is the compiled form, and which one is not.

如果你在Ubuntu上运行nuitka hello.py(以及因此gccELF)你将创建hello.exe`但是只有linux的ELF可执行文件

如果你在Windows上运行nuitka hello.py(以及gcc / PE),你将创建hello.exe但是一个只有windows的PE可执行文件(可以通过WINE在linux中执行)

Nuitka,Cython,cx_freeze不会生成与操作系统无关的可执行文件,但提供了为特定操作系统构建的方法

你正试图做两件事之一

1)在windows中构建linux.如果是这种情况,你需要配置交叉编译或在WINE中进行最终构建(即安装到wine:python,nuitika,gcc …)

2)你在Linux中构建linux. chmod x hello.exe; ./hello.exe#然后可能重命名.

标签:nuitka,wine,python,ubuntu

来源: https://codeday.me/bug/20190824/1712360.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值