我想在Python 3中使用开罗后端的Pango。我选择'cairocffi'是因为这里不相关的原因。我正在尝试运行the example in the documentation。它通过CFFI称呼Pango。示例的最开始部分包含'cairocffi'时'CompiledFFI'而不是'FFI'
import cairocffi
import cffi
ffi = cffi.FFI()
ffi.include(cairocffi.ffi)
给出以下错误。
File "/usr/lib/python3.6/site-packages/cffi/api.py", line 494, in include
type(ffi_to_include).__name__,))
TypeError: ffi.include() expects an argument that is also of type cffi.FFI, not 'CompiledFFI'
我一直在试图理解CFFI文档,但我完全失去了。首先,CompiledFFI
在哪里记录?其次,为什么我在the FFI
interface中看不到include
,cdef
,set_source
方法?主要问题是,我做错了什么?
这个混淆来自于'CompiledFFI'在文档中甚至没有提到。 – beroal
对。 “FFI”和“CompiledFFI”这两种类型通常非常相似,但我在文档中写了一个注释(http://cffi.readthedocs.io/en/latest/ref.html#ffi-interface)。 –
对不起,我在页面上找不到'CompiledFFI'。 – beroal