无法安装kivy。为 kivy 构建轮子失败 (pyproject.toml)

2024-04-11

我不知何故搞砸了我的 pip 或我的 kivy 文件。我的也安装不了我试过了pip install kivy并且git clone https://github.com/kivymd/KivyMD.git --depth 1

我使用的是 macos Monterey 12.6.1 蟒蛇3.11`

我从以下内容开始:

$ python3 -m venv venv
$ . venv/bin/activate
$ pip install kivy

它被挂在 kivy pyproject.toml 的构建轮上。

Requirement already satisfied: certifi>=2017.4.17 in ./myvenv/lib/python3.11/site-packages (from requests->Kivy-Garden>=0.1.4->kivy) (2022.9.24)
Building wheels for collected packages: kivy
  Building wheel for kivy (pyproject.toml) ... -

那么错误代码的末尾看起来像:

kivy/core/image/img_imageio.c:438:62: note: expanded from macro '__Pyx_PyFrame_SetLineNumber'
        #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
                                                            ~~~~~~~^
      /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'struct _frame'
      typedef struct _frame PyFrameObject;
                     ^
      2 warnings and 1 error generated.
       error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for kivy
Failed to build kivy
ERROR: Could not build wheels for kivy, which is required to install pyproject.toml-based projects
(

我完全迷失了。我尝试卸载并重新安装软件包,我已经完成了pip install wheel , and pip install clang都是从其他 SO 帖子推荐的。


我遇到了同样的问题,所以我在 Kivy Discord 上询问,我被告知 Python 3.11 上还没有 kivy 的轮子。 有人告诉我从源代码构建它,这很有效。https://kivy.org/doc/stable/gettingstarted/installation.html#kivy-source-install https://kivy.org/doc/stable/gettingstarted/installation.html#kivy-source-install

git clone https://github.com/kivy/kivy.git
cd kivy
python3.11 -m pip install cython
python3.11 setup.py build_ext --inplace
make install

最好在虚拟环境中执行此操作

python3.11 -m virtualenv <Environment Name>
cd <Environment Name>
source bin/activate
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法安装kivy。为 kivy 构建轮子失败 (pyproject.toml) 的相关文章

随机推荐