19

だから私は公式サイトの指示に従って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

Webで答えが見つからなかった後、エラーを生成したファイル、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]

したがって、type(__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
    ...

したがって、type(__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のタイプをdouble*として認識していないようです。

4

2 に答える 2

16

同じエラーが発生しました。Cython 0.17.1を使用すると、次のことが役立ちます。

sudo pip install Cython==0.17.1

問題を修正するだけではない場合は、詳細に調べて、この2つのバージョン間で何が変更されたかを確認できます。 https://github.com/cython/cython/blob/master/CHANGES.rst#0172-2012-11-20-ここで関連する問題を見つけることができますが、残念ながら私はC/Cythonの第一人者ではありません。マスターと0.17.1を区別しても、問題がどこにあるかはわかりませんが、必要に応じて自分で問題を調査できます。

于 2012-11-21T06:35:01.990 に答える
0

私も同じエラーが発生しました。私はそれを小さな例にたどり、Cythonメーリングリストにメールを送信しました:https ://groups.google.com/forum/?fromgroups =#!topic / cython-users / fSZgHqrlCOc

于 2013-04-27T02:07:09.563 に答える