How to run a Nuitka compiled Python executable

How to run a Nuitka compiled Python executable

I’m experimenting with Nuitka on Ubuntu 14.04 and trying to create and run an executable. I have a file with the contents

print("Hello please")

Which I’ve turned into hello.exe using the command nuitka However, when I try to run it using Wine 1.7, I get get the following error:

$ wine hello.exe
wine: Bad EXE format for Z:homecrclaytonhello.exe.

I think this is a problem with Nuitka, not Wine because I can use Wine to run a helloworld.exe I created in C#. Does anyone know how to fix it?


I wasn’t having any luck on Ubuntu so I tested out the hello.exe out on my Windows 7 partition (both Ubuntu and Windows are 64-bit) and I got the following error:

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.

Is the problem that Nuitka is creating a 32-bit exe and I’m trying to run it on a 64-bit OS? And if so, anyone know how to fix it?

As per the Nuitka manual

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.

If you run nuitka on Ubuntu (and thusgccELF) you will createhello.exe` BUT an linux-only ELF executable

If you run nuitka on Windows (and thus gcc/ PE) you will create hello.exe BUT a windows-only PE executable (which could be executed in linux via WINE)

Nuitka, Cython, cx_freeze does not produce an OS agnostic executable, but provides means to build for a particular OS

You are trying todo one of two things
1) build in linux for windows. If this is the case you need to configure cross compiling OR do the final build in WINE (ie install into wine: python, nuitika, gcc…)

2) you build in linux for linux. chmod +x hello.exe; ./hello.exe # and then maybe rename.