Convert Python program to C/C++ code?(将 Python 程序转换为 C/C++ 代码?)
问题描述
是否可以将 Python 程序转换为 C/C++?
is it possible to convert a Python program to C/C++?
我需要实现几个算法,我不确定性能差距是否足以证明我在 C/C++ 中执行它时所经历的所有痛苦(我不擅长)).我想写一个简单的算法,并根据这样一个转换后的解决方案对其进行基准测试.如果仅此一项就比 Python 版本快得多,那么我将别无选择,只能用 C/C++ 来实现.
I need to implement a couple of algorithms, and I'm not sure if the performance gap is big enough to justify all the pain I'd go through when doing it in C/C++ (which I'm not good at). I thought about writing one simple algorithm and benchmark it against such a converted solution. If that alone is significantly faster than the Python version, then I'll have no other choice than doing it in C/C++.
推荐答案
是的.查看 Cython.它就是这样做的:将 Python 转换为 C 以提高速度.
Yes. Look at Cython. It does just that: Converts Python to C for speedups.
这篇关于将 Python 程序转换为 C/C++ 代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 Python 程序转换为 C/C++ 代码?


- 将 hdc 内容复制到位图 2022-09-04
- 如何提取 __VA_ARGS__? 2022-01-01
- GDB 不显示函数名 2022-01-01
- 将函数的返回值分配给引用 C++? 2022-01-01
- 使用 __stdcall & 调用 DLLVS2013 中的 GetProcAddress() 2021-01-01
- XML Schema 到 C++ 类 2022-01-01
- OpenGL 对象的 RAII 包装器 2021-01-01
- DoEvents 等效于 C++? 2021-01-01
- 从父 CMakeLists.txt 覆盖 CMake 中的默认选项(...)值 2021-01-01
- 哪个更快:if (bool) 或 if(int)? 2022-01-01