简体   繁体   English

Linux:无法在虚拟环境中安装kivy

[英]Linux : unable to install kivy in virtual environment

I am using python2.7 and created a virtual environment 'kivyenv'.我正在使用 python2.7 并创建了一个虚拟环境 'kivyenv'。 First i install Cython and then kivy in kivyenv.首先我安装 Cython,然后在 kivyenv 中安装 kivy。

pip install Cython
pip install kivy

kivy failed to install giving some error :- kivy 安装失败,出现一些错误:-

In file included from /tmp/pip-build-4T9oG4/kivy/kivy/graphics/opengl.c:274:0:
/tmp/pip-build-4T9oG4/kivy/kivy/graphics/gl_redirect.h:43:22: fatal error: GL/gl.h: No such file or directory
 #   include <GL/gl.h>
                      ^
compilation terminated.
 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Command "/root/kivyenv/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4T9oG4/kivy/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record /tmp/pip-3__DxE-record/install-record.txt --single-version-externally-managed --compile --install-headers
 /root/kivyenv/include/site/python2.7/kivy" failed with error code 1 in /tmp/pip-build-4T9oG4/kivy/

I am using Ubuntu 16.我正在使用 Ubuntu 16。

This is happening because you do not have dependency libraries installed on your system, specifically the ones for OpenGL - most likely you do not have mesa packages installed.发生这种情况是因为您的系统上没有安装依赖库,特别是 OpenGL 的依赖库 - 很可能您没有安装 mesa 包。

Follow the instructions for your specific distribution on how to install all of the needed dependencies at: https://kivy.org/docs/installation/installation-linux.html#using-software-packages按照特定发行版的说明安装所有需要的依赖项: https : //kivy.org/docs/installation/installation-linux.html#using-software-packages

had the same problem.有同样的问题。 the following worked for me:以下对我有用:

pip(3) install Cython==0.26

pip(3) install kivy

hope it helps希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM