Подтвердить что ты не робот

Не удается установить Kivy: ошибка Cython/GCC

поэтому я попытался установить Kivy в соответствии с инструкциями официального сайта:

$ sudo apt-get install python-setuptools python-pygame python-opengl \
  python-gst0.10 python-enchant gstreamer0.10-plugins-good python-dev \
  build-essential libgl1-mesa-dev libgles2-mesa-dev python-pip

$ sudo pip install --upgrade cython

$ sudo easy_install kivy

Это то, что я получаю:

Searching for kivy
Reading http://pypi.python.org/simple/kivy/
Best match: Kivy 1.4.1
Downloading http://pypi.python.org/packages/source/K/Kivy/Kivy-1.4.1.tar.gz#md5=94bba894269e4bdecc7881f256367e01
Processing Kivy-1.4.1.tar.gz
Running Kivy-1.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-MMi2Fv/Kivy-1.4.1/egg-dist-tmp-EcKbfC
[INFO   ] Kivy v1.4.1
Found GLES 2.0 headers at /usr/include/GLES2/gl2.h
Build configuration is:
 * use_opengl_es2  =  True
 * use_glew  =  False
 * use_opengl_debug  =  False
 * use_mesagl  =  False
Generate config.h
Generate config.pxi
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_f_4kivy_8graphics_14transformation_6Matrix_identity’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:2774:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_f_4kivy_8graphics_14transformation_6Matrix_inverse’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:2978:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:2980:13: error: incompatible types when assigning to type    ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_f_4kivy_8graphics_14transformation_6Matrix_multiply’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3364:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3366:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3368:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_pf_4kivy_8graphics_14transformation_6Matrix_20__str__’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3674:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
 error: Setup script exited with error: command 'gcc' failed with exit status 1

После неспособности найти ответ в Интернете я начал исследовать файлы, которые генерировали ошибку: transform.c, transform.pyx и transform.pyd. Я также немного прочитал о Китоне.

Во-первых, все ошибки одного типа:

error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’

Здесь возникает первая ошибка:

__pyx_t_3 = __pyx_v_self->mat;

Тип __ pyx_t_3:

__pyx_t_4kivy_8graphics_14transformation_matrix_t

У него есть это странное имя, потому что оно было создано автоматически из файла transform.pxd:

ctypedef double matrix_t[16]

Итак, введите (__ pyx_t_3) == type (matrix_t) == double *.

Тип __ pyx_v_self:

struct __pyx_obj_4kivy_8graphics_14transformation_Matrix *

Опять же, он был создан из transform.pxd:

ctypedef double matrix_t[16]

cdef class Matrix:
    cdef matrix_t mat
    ...

Поэтому тип (__ pyx_v_self- > mat) == type (Matrix.mat) == type (matrix_t) == double *

Как мы видим, обе стороны присваивания:

__pyx_t_3 = __pyx_v_self->mat;

имеют тип (double *).

Почему эта ошибка:

error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’

то?

Похоже, что компилятор не распознает тип matrix_t как двойной *.

4b9b3361

Ответ 1

Просто встретила ту же ошибку. Использование Cython 0.17.1 помогает мне:

sudo pip install Cython==0.17.1

Если вы хотите не просто исправить проблему, вы можете глубже изучить и проверить, что было изменено между этими двумя версиями. https://github.com/cython/cython/blob/master/CHANGES.rst#0172-2012-11-20 - здесь вы можете найти связанные с этим проблемы, но, к сожалению, я не гуру C/Cython и быстрый взгляд на разницу между master и 0.17.1 doesn ' t говорит мне, где проблема, но если вы хотите, вы можете самостоятельно исследовать проблему.