How to use cx_freeze in Windows to create a package to be used in Linux
To create a Linux executable, you need to freeze it in Linux. To create a Mac executable, you need to freeze it on a Mac. That's the way cx_Freeze works, and there isn't an option you can use to build executables for other platforms.
If you make a Windows executable, Linux users might be able to run it with Wine. But that's a workaround, and there's no guarantee that it will work.
How to use cx_Freeze to make an executable python program
When you type python setup.py build, you are supposed to be in the directory with setup.py and not anywhere else. So use the command cd to get there.
cx_freeze is not in your path variable so cxfreeze Julian date 2.py --target-dir dist will not work and you have to instead add it to your path (somehow) [not recommended]
Hope this helped.
P.S.
executables = [Executable("Julian date 2.py")]) takes base too. If you want a console application:
executables = [Executable("Julian date 2.py",base='None')])
Gui for windows:
executables = [Executable("Julian date 2.py",base='Win32GUI')])
And you forgot your exe options in setup(). I recommend adapting the setup.py script on cx_freeze doxs:
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = "None"
setup( name = "name",
version = "0.1",
description = " ",
options = {"build_exe": build_exe_options},
executables = [Executable("file.py", base=base)])
cx_freeze PyGObject application on Linux
So the problem was not in missing libraries (as they were in the path anyway) but missing package in setup.py
script. The correct setup is as follows:
from cx_Freeze import setup, Executable
setup(name="GUI Test",
description="GUITest",
version="0.1",
options={"build_exe": {"build_exe": "Bin/pygobject",
"create_shared_zip": False,
"packages": ["gi"],
}},
executables=[Executable(script="hello_pygobject.py",
targetName="hello",
appendScriptToExe=True,
)]
)
Related Topics
Linux Udp Max Size of Receive Buffer
How to Get Notified for Ip Address Changes Automatically
Print Kernel's Page Table Entries
Option to Display Control Characters in Gedit
How to Catch Duplicate Entries in Text File in Linux
Ansible Conditional Based on Stdout of Result
Linking Boost Library in Linux
Use Sudo Inside Dockerfile (Alpine)
Run Command 'At ' 5 Seconds from Now
Match All Files Under All Nested Directories with Shell Globbing
Pause Programmatically Video Player Mpv
Running R Scripts or Commands with Interpretor in Unix for Unix-Layman
How to Read a Sector Using a Bio Request in Linux Kernel
Trying to Find All the Kernel Modules Needed for My MAChine Using Shell Script
Creating a Raw Printer Queue in Cups (Host) and Adding Them Through Cups (Client)