Skip to content

Instantly share code, notes, and snippets.

@rguillebert
Created June 7, 2014 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rguillebert/942712f51a31c7155089 to your computer and use it in GitHub Desktop.
Save rguillebert/942712f51a31c7155089 to your computer and use it in GitHub Desktop.
import cffi
ffi = cffi.FFI()
ffi.cdef("""
void Py_Initialize();
int PyRun_SimpleString(const char *command);
void Py_Finalize();
""")
cpython = ffi.dlopen("python2.7")
cpython.Py_Initialize()
cpython.PyRun_SimpleString("print 'Hello World'")
cpython.Py_Finalize()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment