Kivy: macOS 10.13 Python2.7.10 通过 pip 安装 kivy 错误

创建于 2017-11-04  ·  9评论  ·  资料来源: kivy/kivy

版本

  • 蟒蛇:2.7.10
  • 操作系统:macOS 10.13 High Sierra
  • 基维:不适用
  • Kivy 安装方法:sudo pip install kivy

描述

尝试使用 pip 方法安装 Kivy。 我已经通过 Homebrew 成功安装了 Cython 和其他先决条件。
输入“sudo pip install kivy”时收到以下错误

代码和日志

命令 "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-lzJfp5/kivy/setup.py';f=getattr(tokenize, 'open', open )(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp /pip-lPcVuX-record/install-record.txt --single-version-externally-managed --compile" 失败,错误代码 1 在 /private/tmp/pip-build-lzJfp5/kivy/

最有用的评论

@parabolize我不是 mac 用户,但由于下面的日志,这对我来说似乎是一个权限问题:

...
    running install_data
    creating /System/Library/Frameworks/Python.framework/Versions/2.7/share
     error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted
error
...

因此,您可以尝试将--user标志添加到您的 pip 安装中。

pip install --user --verbose https://github.com/kivy/kivy/zipball/master

所有9条评论

👋 感谢您在这里打开第一期! 请务必遵循问题模板!

@krauseling嗨,请使用 --verbose 运行 pip install。 此输出非常通用,根本没有用。

@KeyWeeUsr ,感谢您的回复。 这是一个更详细的输出,但由于最大长度而不是全部。

cythoning /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.pyx to /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c
building 'kivy.graphics.vertex_instructions' extension
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -arch x86_64 -I/private/tmp/pip-build-ZqJR8f/kivy/kivy/include -I/private/tmp/pip-build-ZqJR8f/kivy/kivy/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c -o build/temp.macosx-10.13-intel-2.7/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.o -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks
In file included from /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:242:
In file included from /private/tmp/pip-build-ZqJR8f/kivy/kivy/include/gl_redirect.h:53:
/private/tmp/pip-build-ZqJR8f/kivy/kivy/include/common_subset.h:461:9: warning: 'GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS' macro redefined [-Wmacro-redefined]
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
        ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/include/gl_redirect.h:30:9: note: previous definition is here
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS        0x8CD9
        ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:16906:15: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
  __pyx_v_l = __pyx_t_2;
            ~ ^~~~~~~~~
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:55505:32: warning: unused function '__Pyx_PyUnicode_FromString' [-Wunused-function]
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
                               ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:332:29: warning: unused function '__Pyx_Py_UNICODE_strlen' [-Wunused-function]
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
                            ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:55682:33: warning: unused function '__Pyx_PyInt_FromSize_t' [-Wunused-function]
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
                                ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:51864:26: warning: unused function '__Pyx_GetBufferAndValidate' [-Wunused-function]
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
                         ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:51898:27: warning: unused function '__Pyx_SafeReleaseBuffer' [-Wunused-function]
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
                          ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:51970:1: warning: unused function '__pyx_add_acquisition_count_locked' [-Wunused-function]
__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:51980:1: warning: unused function '__pyx_sub_acquisition_count_locked' [-Wunused-function]
__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:4354:26: warning: unused function 'resize' [-Wunused-function]
static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
                         ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:54458:32: warning: unused function '__Pyx_PyInt_From_unsigned_long' [-Wunused-function]
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
                               ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:54829:27: warning: function '__Pyx_PyInt_As_char' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
                          ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:35183:35: warning: unused function '__pyx_f_7cpython_5array_copy' [-Wunused-function]
static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
                                  ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:35337:26: warning: unused function '__pyx_f_7cpython_5array_extend' [-Wunused-function]
static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
                         ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.c:35411:27: warning: unused function '__pyx_f_7cpython_5array_zero' [-Wunused-function]
static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
                          ^
15 warnings generated.
cc -bundle -undefined dynamic_lookup -Wl,-F. -arch x86_64 build/temp.macosx-10.13-intel-2.7/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/vertex_instructions.o -o build/lib.macosx-10.13-intel-2.7/kivy/graphics/vertex_instructions.so -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks -lm
cythoning /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.pyx to /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c
building 'kivy.graphics.texture' extension
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -arch x86_64 -I/private/tmp/pip-build-ZqJR8f/kivy/kivy/include -I/private/tmp/pip-build-ZqJR8f/kivy/kivy/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c -o build/temp.macosx-10.13-intel-2.7/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.o -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks
In file included from /private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:242:
In file included from /private/tmp/pip-build-ZqJR8f/kivy/kivy/include/gl_redirect.h:53:
/private/tmp/pip-build-ZqJR8f/kivy/kivy/include/common_subset.h:461:9: warning: 'GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS' macro redefined [-Wmacro-redefined]
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
        ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/include/gl_redirect.h:30:9: note: previous definition is here
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS        0x8CD9
        ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:5152:24: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    __pyx_v_datasize = __pyx_t_7;
                     ~ ^~~~~~~~~
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:38248:32: warning: unused function '__Pyx_PyUnicode_FromString' [-Wunused-function]
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
                               ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:332:29: warning: unused function '__Pyx_Py_UNICODE_strlen' [-Wunused-function]
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
                            ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:34975:26: warning: unused function '__Pyx_GetBufferAndValidate' [-Wunused-function]
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
                         ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:35009:27: warning: unused function '__Pyx_SafeReleaseBuffer' [-Wunused-function]
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
                          ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:35081:1: warning: unused function '__pyx_add_acquisition_count_locked' [-Wunused-function]
__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:35091:1: warning: unused function '__pyx_sub_acquisition_count_locked' [-Wunused-function]
__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:35640:32: warning: unused function '__Pyx_PyTuple_GetSlice' [-Wunused-function]
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
                               ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:35670:32: warning: unused function '__Pyx_GetItemInt_List_Fast' [-Wunused-function]
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                               ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:35685:32: warning: unused function '__Pyx_GetItemInt_Tuple_Fast' [-Wunused-function]
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                               ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:3946:26: warning: unused function 'resize' [-Wunused-function]
static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
                         ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:7182:26: warning: unused function '__pyx_f_4kivy_8graphics_7texture__is_gl_format_supported' [-Wunused-function]
static CYTHON_INLINE int __pyx_f_4kivy_8graphics_7texture__is_gl_format_supported(PyObject *__pyx_v_x) {
                         ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:19255:35: warning: unused function '__pyx_f_7cpython_5array_copy' [-Wunused-function]
static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
                                  ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:19409:26: warning: unused function '__pyx_f_7cpython_5array_extend' [-Wunused-function]
static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
                         ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.c:19483:27: warning: unused function '__pyx_f_7cpython_5array_zero' [-Wunused-function]
static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
                          ^
16 warnings generated.
cc -bundle -undefined dynamic_lookup -Wl,-F. -arch x86_64 build/temp.macosx-10.13-intel-2.7/private/tmp/pip-build-ZqJR8f/kivy/kivy/graphics/texture.o -o build/lib.macosx-10.13-intel-2.7/kivy/graphics/texture.so -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks -lm
cythoning /private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio/audio_sdl2.pyx to /private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio/audio_sdl2.c
building 'kivy.core.audio.audio_sdl2' extension
creating build/temp.macosx-10.13-intel-2.7/private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -arch x86_64 -I/private/tmp/pip-build-ZqJR8f/kivy/kivy/include -I/usr/local/include/SDL2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio/audio_sdl2.c -o build/temp.macosx-10.13-intel-2.7/private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio/audio_sdl2.o -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks
/private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio/audio_sdl2.c:1374:63: error: use of undeclared identifier 'MIX_INIT_MODPLUG'; did you mean 'MIX_INIT_MOD'?
  __pyx_v_want_flags = (__pyx_v_want_flags | ((MIX_INIT_MOD | MIX_INIT_MODPLUG) | MIX_INIT_FLUIDSYNTH));
                                                              ^~~~~~~~~~~~~~~~
                                                              MIX_INIT_MOD
/usr/local/include/SDL2/SDL_mixer.h:80:5: note: 'MIX_INIT_MOD' declared here
    MIX_INIT_MOD    = 0x00000002,
    ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio/audio_sdl2.c:1374:83: error: use of undeclared identifier 'MIX_INIT_FLUIDSYNTH'
  __pyx_v_want_flags = (__pyx_v_want_flags | ((MIX_INIT_MOD | MIX_INIT_MODPLUG) | MIX_INIT_FLUIDSYNTH));
                                                                                  ^
/private/tmp/pip-build-ZqJR8f/kivy/kivy/core/audio/audio_sdl2.c:4527:69: error: use of undeclared identifier 'MIX_INIT_MODPLUG'; did you mean 'MIX_INIT_MOD'?
  __pyx_t_2 = ((__pyx_v_4kivy_4core_5audio_10audio_sdl2_mix_flags & MIX_INIT_MODPLUG) != 0);
                                                                    ^~~~~~~~~~~~~~~~
                                                                    MIX_INIT_MOD
/usr/local/include/SDL2/SDL_mixer.h:80:5: note: 'MIX_INIT_MOD' declared here
    MIX_INIT_MOD    = 0x00000002,
    ^
3 errors generated.
 error: command 'cc' failed with exit status 1

错误
打扫干净...
删除 /private/tmp/pip-build-ZqJR8f/kivy 中的源代码
命令 "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-ZqJR8f/kivy/setup.py';f=getattr(tokenize, 'open', open )(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp /pip-LtAhbV-record/install-record.txt --single-version-externally-managed --compile" 失败,错误代码 1 在 /private/tmp/pip-build-ZqJR8f/kivy/
异常信息:
回溯(最近一次调用最后一次):
文件“/Library/Python/2.7/site-packages/pip/basecommand.py”,第 215 行,在主目录中
status = self.run(options, args)
运行中的文件“/Library/Python/2.7/site-packages/pip/commands/install.py”,第 342 行
前缀=options.prefix_path,
文件“/Library/Python/2.7/site-packages/pip/req/req_set.py”,第784行,安装
**夸格
文件“/Library/Python/2.7/site-packages/pip/req/req_install.py”,第878行,安装
微调器=微调器,
文件“/Library/Python/2.7/site-packages/pip/utils/__init__.py”,第 707 行,在 call_subprocess
% (command_desc, proc.returncode, cwd))
安装错误:命令“/usr/bin/python -u -c”import setuptools, tokenize;__file__='/private/tmp/pip-build-ZqJR8f/kivy/setup.py';f=getattr(tokenize, 'open' , open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-LtAhbV-record/install-record.txt --single-version-externally-managed --compile" 失败,错误代码 1 在 /private/tmp/pip-build-ZqJR8f/kivy/

看起来像#5457

正如@parabolize所说,这是与 SDL2_mixer 相关的问题。 尝试以这种方式安装 master 分支:

pip install --verbose https://github.com/kivy/kivy/zipball/master

它应该可以正确编译。

这也不起作用......:/
我已将您建议的全部输出粘贴到 Pastebin,链接如下。

https://pastebin.com/qPcE3Umx

@parabolize我不是 mac 用户,但由于下面的日志,这对我来说似乎是一个权限问题:

...
    running install_data
    creating /System/Library/Frameworks/Python.framework/Versions/2.7/share
     error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted
error
...

因此,您可以尝试将--user标志添加到您的 pip 安装中。

pip install --user --verbose https://github.com/kivy/kivy/zipball/master

成功安装 Kivy-1.10.1.dev0
打扫干净...

好东西@AndreMiras! 这终于成功了。 非常感谢大家的帮助。 我期待将 kivy 制作成一些可爱的应用程序。

在 High Sierra 上使用 python 3.6.2 有同样的问题, @AndreMiras解决方案有效! 谢谢!

此页面是否有帮助?
0 / 5 - 0 等级