Cython 可以编译成 EXE 吗? [英] Can Cython compile to an EXE?

查看:45
本文介绍了Cython 可以编译成 EXE 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 Cythons 的目的是什么.它是用类似 Python 的语言编写可编译的 C 扩展,以便在您的代码中产生加速.我想知道(并且似乎无法使用我的 google-fu 找到)是 Cython 是否可以以某种方式编译为可执行格式,因为它似乎已经将 python 代码分解为 C.

I know what Cythons purpose is. It's to write compilable C extensions in a Python-like language in order to produce speedups in your code. What I would like to know (and can't seem to find using my google-fu) is if Cython can somehow compile into an executable format since it already seems to break python code down into C.

我已经在使用 Py2Exe,它只是一个打包器,但我有兴趣使用它来编译成更难解压的东西(使用 Py2EXE 打包的任何东西基本上都可以使用我不想要的 7zip 提取)

I already use Py2Exe, which is just a packager, but am interested in using this to compile down to something that is a little harder to unpack (Anything packed using Py2EXE can basically just be extracted using 7zip which I do not want)

看来,如果这不可能,我的下一个选择就是编译我的所有代码并将其作为模块加载,然后使用 py2exe 将其打包,至少获得大多数 将我的代码转换成编译形式,对吗?

It seems if this is not possible my next alternative would just be to compile all my code and load it as a module and then package that using py2exe at least getting most of my code into compiled form, right?

推荐答案

根据 嵌入 Pyrex HOWTO.(Pyrex 实际上是 Cython 的上一代产品.)

In principal it appears to be possible to do something like what you want, according to the Embedding Pyrex HOWTO. (Pyrex is effectively a previous generation of Cython.)

嗯……这个名字暗示了比我第一次尝试更好的搜索:嵌入 cython"导致 这个页面听起来像你想要的.

Hmm... that name suggests a better search than I first tried: "embedding cython" leads to this page which sounds like what you want.

这篇关于Cython 可以编译成 EXE 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆