如何在linux中使用cx_freeze来创建一个在windows中使用的包

时间:2022-01-28 18:02:57

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.

如何在linux中使用cx_freeze来创建一个在.exe或.bin文件等窗口中使用的包。我在linux中测试了cx_freeze但是在linux和windows中制作包是未知的。

for example :

例如 :

$ cxfreeze gui.py

and this is file that maked :

这是制作的文件:

gui

that is running only in linux.

那只在linux中运行。

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

有没有办法使用cx_freeze来制作exe或bin包?

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

或者使用任何替代方法而不是cx_freeze来使一个bin文件在其他平*立执行?

I use python3(3.x).

我使用python3(3.x)。

3 个解决方案

#1


8  

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

我一直试图让cx_freeze在各种可能的方式上正常工作,但没有运气......我正在尝试使用Ubuntu做你现在正在做的事情,但遗憾的是我发现了这个:https://cx_freeze.readthedocs。组织/ EN /最新/ faq.html常见问题#与 - 运行 - 冻结计划

" 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.

cx_Freeze适用于Windows,Mac和Linux,但在每个平台上它只生成在该平台上运行的可执行文件。因此,如果要冻结Windows程序,请在Windows上冻结它;如果你想在Mac上运行它,请在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?

在紧要关头,您可以尝试使用Wine制作Windows可执行文件。我们的经验是,您需要在运行cx_Freeze之后手动复制一些文件以使可执行文件正常工作。我们不建议使用此选项。 “我想唯一的选择是尝试用葡萄酒吗?你有运气吗?

#2


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."

你看到了吗?也许这会让你麻烦:“Windows上的Python需要Microsoft Visual C ++ Redistributable Package.Python 2.6-3.2使用2008版本,并且由于安装方式的原因,cx_Freeze不会自动为您的应用程序复制它。”

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.

无论如何,使用这个工具(cx_freeze)是如此复杂和低效,以至于编写整个程序可能比将其正确转换为Windows可执行文件更容易。我真的希望将来有人会为Python 3编写一个更简洁,更简单的转换工具。

#3


0  

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

cx_freeze应该如站点中所述跨平台工作:

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

cx_Freeze是跨平台的,应该可以在Python本身可以使用的任何平台上运行

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

(虽然我没有在linux上试过)但你可以在这里找到一个简单的解释

#1


8  

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

我一直试图让cx_freeze在各种可能的方式上正常工作,但没有运气......我正在尝试使用Ubuntu做你现在正在做的事情,但遗憾的是我发现了这个:https://cx_freeze.readthedocs。组织/ EN /最新/ faq.html常见问题#与 - 运行 - 冻结计划

" 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.

cx_Freeze适用于Windows,Mac和Linux,但在每个平台上它只生成在该平台上运行的可执行文件。因此,如果要冻结Windows程序,请在Windows上冻结它;如果你想在Mac上运行它,请在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?

在紧要关头,您可以尝试使用Wine制作Windows可执行文件。我们的经验是,您需要在运行cx_Freeze之后手动复制一些文件以使可执行文件正常工作。我们不建议使用此选项。 “我想唯一的选择是尝试用葡萄酒吗?你有运气吗?

#2


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."

你看到了吗?也许这会让你麻烦:“Windows上的Python需要Microsoft Visual C ++ Redistributable Package.Python 2.6-3.2使用2008版本,并且由于安装方式的原因,cx_Freeze不会自动为您的应用程序复制它。”

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.

无论如何,使用这个工具(cx_freeze)是如此复杂和低效,以至于编写整个程序可能比将其正确转换为Windows可执行文件更容易。我真的希望将来有人会为Python 3编写一个更简洁,更简单的转换工具。

#3


0  

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

cx_freeze应该如站点中所述跨平台工作:

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

cx_Freeze是跨平台的,应该可以在Python本身可以使用的任何平台上运行

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

(虽然我没有在linux上试过)但你可以在这里找到一个简单的解释