簡體   English   中英

無法安裝Kivy:Cython / GCC錯誤

[英]Can't install Kivy: Cython/GCC error

所以我嘗試按照官方網站的說明安裝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

在網絡中找不到答案后,我開始研究產生錯誤的文件:transformation.c,transformation.pyx和transformation.pyd。 我還讀了一些關於Cython的內容。

首先,所有錯誤都屬於同一類:

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

它有這個奇怪的名稱,因為它是從transformation.pxd文件自動生成的:

ctypedef double matrix_t[16]

所以,輸入( __pyx_t_3 )== type(matrix_t)== double *。

__pyx_v_self的類型是:

struct __pyx_obj_4kivy_8graphics_14transformation_Matrix *

同樣,它是從transformation.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;

是(雙*)類型。

為什么會出現此錯誤:

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

被提出呢?

看起來編譯器沒有將matrix_t的類型識別為double *。

剛遇到同樣的錯誤。 使用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之間進行區分並沒有說明問題出在哪里,但如果你願意,你可以自己調查問題。

我也有同樣的錯誤。 我將其追溯到一個小例子並發送電子郵件到Cython郵件列表: https ://groups.google.com/forum/?fromgroups = #!topic / cyce-users / fSZgHqrlCOc

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM