无法安装" Cairocffi"

时间:2016-01-11 10:37:01

标签: python install pip cairo python-cffi

我正在使用python3,我正在尝试安装"的 cairocffi "在Ubuntu上。 为此,我已成功安装:

  1. 蟒-dev的
  2. libffi-dev的
  3. CFFI
  4. 但是当我试图安装" cairocffi"与pip install cairocffi,我得到了:

          File "/usr/local/lib/python3.2/dist-packages/setuptools/dist.py", line 272
    , in __init__
            _Distribution.__init__(self,attrs)
          File "/usr/lib/python3.2/distutils/dist.py", line 261, in __init__
            self.finalize_options()
          File "/usr/local/lib/python3.2/dist-packages/setuptools/dist.py", line 327
    , in finalize_options
            ep.load()(self, ep.name, value)
          File "/usr/local/lib/python3.2/dist-packages/cffi/setuptools_ext.py", line
     161, in cffi_modules
            add_cffi_module(dist, cffi_module)
          File "/usr/local/lib/python3.2/dist-packages/cffi/setuptools_ext.py", line
     48, in add_cffi_module
            execfile(build_file_name, mod_vars)
          File "/usr/local/lib/python3.2/dist-packages/cffi/setuptools_ext.py", line
     24, in execfile
            exec(code, glob, glob)
          File "cairocffi/ffi_build.py", line 30, in <module>
            ffi.cdef(constants._CAIRO_HEADERS)
        AttributeError: 'module' object has no attribute '_CAIRO_HEADERS'
    
        ----------------------------------------
        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-y0b_ir/cairocffi
    

3 个答案:

答案 0 :(得分:22)

我的问题是通过安装特定版本的cairocffi(版本= 0.6)

来解决的
pip install cairocffi==0.6

答案 1 :(得分:16)

我今天也遇到了这个问题。您是否正在使用Real Python课程?

无论如何,为了解决这个问题,我安装了python-dev的python 3版本:

sudo apt-get install python3-dev
sudo apt-get install libffi-dev
sudo pip3 install cffi
sudo pip3 install cairocffi

希望这有帮助!

答案 2 :(得分:2)

安装libffi-dev包可以解决这个问题 只需运行sudo apt install libffi-dev