Question:
Using Ubuntu 16.04, I installed virtualenv and created a virtual environment.
In this virtual environment I installed Cython using:
pip install cython==0.23
How to install Kivy:
pip install kivy
But it returns a bunch of errors, including:
/tmp/pip-build-RTmWI8/kivy/kivy/graphics/opengl.c:4:20: fatal error: Python.h: Arquivo ou diretório não encontrado
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Command "/home/usuario/testeKivy/teste1/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-RTmWI8/kivy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZZtk3g-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/usuario/testeKivy/teste1/include/site/python2.7/kivy" failed with error code 1 in /tmp/pip-build-RTmWI8/
What dependencies are missing?
Answer:
Well, after learning a bit more by reading the comments, I realized that solving the dependency problem was "easy".
Kivy's official website itself provided the necessary information. What confused me was having to install packages on the (global) system if my intention was to use Kivy in a virtual environment with virtualenv
. When I learned that it was necessary to install packages globally so that Kivy could work (even in the virtual environment), I just followed the installation list :
sudo apt-get install -y \
python-pip \
build-essential \
git \
python \
python-dev \
ffmpeg \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libportmidi-dev \
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev
From there, I accessed the virtual environment, which I had already created with virtualenv
, and ran the commands:
pip install cython==0.23
pip install kivy
And ready! Thank you very much for the help of everyone who contributed to my learning. Hugs.