[英]Compiling .c files generated by Cython into exe files
I'm newbie to python . 我是python的新手。 I want to compile .c files generated by cython into .exe files .
我想将cython生成的.c文件编译成.exe文件。 now i know there are programs like py2exe or cx_Freeze that can do the same but i want to make standalone executables (if possible) .
现在我知道有像py2exe或cx_Freeze这样的程序可以做同样的但我想制作独立的可执行文件(如果可能的话)。 now when i try to compile the cython .c file into exe using
现在当我尝试将cython .c文件编译成exe时使用
cl.exe /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python\include -Ic:\Python\PC /Tctest.c /link /OUT:"test.exe" /SUBSYSTEM:CONSOLE /MACHINE:X86 /LIBPATH:c:\Python\libs /LIBPATH:c:\Python\PCbuild
Compiling with cl as explained in Can Cython compile to an EXE? 如在Cython中编译到EXE中所解释的那样用cl 编译?
I get errors 我收到错误
c:\Python\include\pyconfig.h(68) : fatal error C1083: Cannot open include file:'io.h': No such file or directory
please help 请帮忙
If you just want to create standalone executables I recommend you to use PyInstaller, easily downloadable on Windows (I suppose you are using Windows) by command prompt with: 如果您只想创建独立的可执行文件,我建议您使用PyInstaller,可以通过命令提示符在Windows上轻松下载(我想您使用的是Windows):
pip install pyinstaller
(remember to add pip path to environment variables) or on Mac Os X: (记得将pip路径添加到环境变量中)或Mac Os X上:
we strongly recommend that you install these using either MacPorts or Homebrew.
我们强烈建议您使用MacPorts或Homebrew安装它们。
Pyinstaller can compile .py files in standalone executables with the following command: Pyinstaller可以使用以下命令编译独立可执行文件中的.py文件:
pyinstaller yourfilename.py -F
You can also add --windowed
flag to make it a process (to hide console) 您还可以添加
--windowed
标志以使其成为一个进程(隐藏控制台)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.