C 运行 可以编译 Python 代码(.pyc 文件)吗?

Can C run compiled Python code (.pyc files)?

考虑到主要 Python 实现 CPython 是用 C 编写的,并且存在可以将 Python 代码转换为 C 的库,是否可以 运行用 C 或 C++ 编译 Python 字节码?

首先,您不能运行 C 中的任何内容,C 是一种编程语言。您可以将 python 嵌入到您的 C 程序中(参见 Documentation),因为 python 可以编译为库。但是 Python 不仅是 pyc 文件,它还包含许多模块,这使得 python 如此强大。