在 Windows 上将 cx_Freeze 安装到 python
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25270885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
installing cx_Freeze to python at windows
提问by mesel
I am using python 3.4 at win-8. I want to obtain .exe program from python code. I learned that it can be done by cx_Freeze.
我在 win-8 上使用 python 3.4。我想从 python 代码中获取 .exe 程序。我了解到它可以通过 cx_Freeze 来完成。
In MS-DOS command line, I wrote pip install cx_Freeze to set up cx_Freeze. It is installed but it is not working.
在 MS-DOS 命令行中,我编写了 pip install cx_Freeze 来设置 cx_Freeze。它已安装,但无法正常工作。
(When I wrote cxfreeze to command line, I get this warning:C:\Users\USER>cxfreeze 'cxfreeze' is not recognized as an internal or external command,operable program or batch file.)
(当我将 cxfreeze 写入命令行时,我收到此警告:C:\Users\USER>cxfreeze 'cxfreeze' 未被识别为内部或外部命令、可运行的程序或批处理文件。)
(I also added location of cxfreeze to "PATH" by environment variables)
(我还通过环境变量将 cxfreeze 的位置添加到“PATH”)
Any help would be appriciated thanks.
任何帮助都会感谢。
采纳答案by Puggie
I faced a similar problem (Python 3.4 32-bit, on Windows 7 64-bit). After installation of cx_freeze, three files appeared in c:\Python34\Scripts\:
我遇到了类似的问题(Python 3.4 32 位,Windows 7 64 位)。安装cx_freeze后,出现三个文件c:\Python34\Scripts\:
cxfreezecxfreeze-postinstallcxfreeze-quickstart
cxfreezecxfreeze-postinstallcxfreeze-quickstart
These files have no file extensions, but appear to be Python scripts. When you run python.exe cxfreeze-postinstallfrom the command prompt, two batch files are being created in the Python scripts directory:
这些文件没有文件扩展名,但似乎是 Python 脚本。当您python.exe cxfreeze-postinstall从命令提示符运行时,会在 Python 脚本目录中创建两个批处理文件:
cxfreeze.batcxfreeze-quickstart.bat
cxfreeze.batcxfreeze-quickstart.bat
From that moment on, you should be able to run cx_freeze.
从那一刻起,您应该能够运行 cx_freeze。
cx_freeze was installed using the provided win32 installer (cx_Freeze-4.3.3.win32-py3.4.exe). Installing it using pip gave exactly the same result.
cx_freeze 是使用提供的 win32 安装程序 ( cx_Freeze-4.3.3.win32-py3.4.exe)安装的。使用 pip 安装它给出了完全相同的结果。
回答by Puggie
go to https://pypi.python.org/pypi?:action=display&name=cx_Freeze&version=4.3.4and click the one you want to download :)
转到https://pypi.python.org/pypi?:action=display&name=cx_Freeze&version=4.3.4并单击您要下载的那个 :)
回答by Yue
Make sure the Version of Python is correct, if you have more than one version on your computer, just simply type "python" in console to check the version of your python. I just had this problem earlier.
确保 Python 的版本正确,如果您的计算机上有多个版本,只需在控制台中键入“ python”即可检查您的 Python 版本。我刚刚遇到了这个问题。

