是否可以自然编译Python(除了pyc字节码)? [英] Is it possible to compile Python natively (beyond pyc byte code)?
本文介绍了是否可以自然编译Python(除了pyc字节码)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否可以从Python脚本创建可执行模块。我需要具有最高性能和Python脚本的灵活性,而不需要在Python环境中运行。
I wonder if it is possible to create an executable module from a Python script. I need to have the most performance and the flexibility of Python script, without needing to run in the Python environment. I would use this code to load on demand user modules to customize my application.
推荐答案
- 有
- There's pyrex that compiles python like source to python extension modules
- rpython which allows you to compile python with some restrictions to various backends like C, LLVM, .Net etc.
- There's also shed-skin which translates python to C++, but I can't say if it's any good.
- PyPy implements a JIT compiler which attempts to optimize runtime by translating pieces of what's running at runtime to machine code, if you write for the PyPy interpreter that might be a feasible path.
- The same author that is working on JIT in PyPy wrote psyco previously which optimizes python in the CPython interpreter.
这篇关于是否可以自然编译Python(除了pyc字节码)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文