0

I am creating an installer for the application I have developed. Below is the setup file I am using

from cx_Freeze import setup, Executable 

buildOptions = dict(excludes = ["tkinter"], includes =["idna.idnadata"], optimize=1)

setup(name = "SoftwareGateway" , 
      version = "0.1" , 
      description = "" , 
      options =dict(build_exe = buildOptions),
      executables = [Executable("main.py", base = base)])

By default this builds an installer for a 32-bit target. I am saying this because, when I install this, it gets installed in ProgramFiles(x86).

The problem I am facing is, I have an IoT-Hub client library which is 64-bit (.pyc file). I am able to create the installer but that is for x86. When I install and try to run, it throws an error

DLL load failed, %1 is not valid win32 application

So, as a first step, I would like to create an installer for a 64-bit target and see if it works. Please provide a way with which I can create an installer for a 64-bit machine.

Later I will try to find an IoT-Hub client library for 32-bit and build it for x86 as well.

jpeg
  • 2,372
  • 4
  • 18
  • 31
Sagar
  • 1,115
  • 2
  • 13
  • 22

1 Answers1

1

cx_Freeze basically creates an executable for the platform and configuration of the python installation it belongs to. Quoting the cx_Freeze documentation:

cx_Freeze works on Windows, Mac and Linux, but on each platform it only makes an executable that runs on that platform. So if you want to freeze your program for Windows, freeze it on Windows; if you want to run it on Macs, freeze it on a Mac.

So on a Windows 64-bit machine, you can create a 64-bit executable by running the setup script using a 64-bit python installation. This executable will work on Windows 64-bit machines only.

On a Windows 64-bit machine, you can also create a 32-bit executable by running the setup script using a 32-bit python installation. This executable will work on Windows 32-bit and 64-bit machines. See also Can I make a 32 bit program with cx_freeze if I have a 64 bit OS?

jpeg
  • 2,372
  • 4
  • 18
  • 31