how to use cx_freeze in linux to create a package

2019-01-19 01:24发布

问题:

how to use cx_freeze in linux to create a one package to be used in windows like .exe or .bin file. I tested cx_freeze in linux but that make package for linux and in windows is unknown.

for example :

$ cxfreeze gui.py

and this is file that maked :

gui

that is running only in linux.

Is there any way to use cx_freeze for making exe or bin package ?

Or any alternative way instead of cx_freeze to make one bin file to execute in other platform independent?

I use python3(3.x).

回答1:

I've been trying to get cx_freeze properly working on windows in every way possible but with no luck...I was trying to do what you are doing now using Ubuntu but I found this, sadly: https://cx_freeze.readthedocs.org/en/latest/faq.html#problems-with-running-frozen-programs

" Freezing for other platforms

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.

At a pinch, you can try to make a Windows executable using Wine. Our experience is that you need to copy some files in manually after cx_Freeze has run to make the executable work. We don’t recommend this option. " I guess the only option is to try doing it with wine? Have you had any luck?



回答2:

Did you saw this? Maybe this is making you trouble: "Python on Windows requires the Microsoft Visual C++ Redistributable Package. Python 2.6-3.2 uses the 2008 version, and because of how this is installed, cx_Freeze doesn’t automatically copy it for your application."

http://cx-freeze.readthedocs.org/en/latest/faq.html#microsoft-visual-c-redistributable-package

Anyway, using this tool (cx_freeze) is so complicated and inefficient that it is probably more easy to write a whole program than to convert it properly to windows executable. I really hope that someone in future will write a more concise and simple convert tool for Python 3.



回答3:

cx_freeze should work cross-platform as stated in the site :

cx_Freeze is cross platform and should work on any platform that Python itself works on

(I haven't tried in linux though) but you can find a easy explanation over here