Instalando o Kivy Ubuntu 16.04 64 bits

1

os: linux (16.04 LTS do Ubuntu, 64 bits) python_version: 3.6.3

  • Usando o virtualenv.
  • Tentei instalar muitas versões do kivy com muitas versões diferentes do cython, mas sempre recebi o mesmo erro, como abaixo.
  • Depois de dar "pip install kivy", instale alguns pacotes:  certificado (2017.11.5)  chardet (3.0.4)  Cython (0,26)  docutils (0,14)  idna (2.6)  Kivy-Garden (0.1.4)  pip (9.0.1)  Pigmentos (2.2.0)  pedidos (2.18.4)  setuptools (38.4.0)  urllib3 (1,22)  roda (0.30.0)
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-build-c8ofsvs6/kivy/kivy/include -I/usr/include/python3.6m -I/home/ubuntu/venv/include/python3.6m -c /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c -o

build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy/kivy/_event.o /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c:4:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for kivy
  Running setup.py clean for kivy
Failed to build kivy
Installing collected packages: kivy
  Running setup.py install for kivy ... error
    Complete output from command /home/ubuntu/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-c8ofsvs6/kivy/setup.py';f=getattr(tokenize,

'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-vcdy_iv_-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/venv/include/site/python3.6/kivy: Using distutils

e último

>     > Detected compiler is unix
>     >     skipping '/tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c' Cython extension (up-to-date)
>     >     building 'kivy._event' extension
>     >     creating build/temp.linux-x86_64-3.6
>     >     creating build/temp.linux-x86_64-3.6/tmp
>     >     creating build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6
>     >     creating build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy
>     >     creating build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy/kivy
>     >     x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-build-c8ofsvs6/kivy/kivy/include -I/usr/include/python3.6m -I/home/ubuntu/venv/include/python3.6m -c /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c -o
>     > build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy/kivy/_event.o
>     >     /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c:4:20: fatal error: Python.h: No such file or directory
>     >     compilation terminated.
>     >      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
>     >     
>     >     ---------------------------------------- Command "/home/ubuntu/venv/bin/python3 -u -c "import setuptools,
>     > tokenize;__file__='/tmp/pip-build-c8ofsvs6/kivy/setup.py';f=getattr(tokenize,
>     > 'open', open)(__file__);code=f.read().replace('\r\n',
>     > '\n');f.close();exec(compile(code, __file__, 'exec'))" install
>     > --record /tmp/pip-vcdy_iv_-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/venv/include/site/python3.6/kivy" failed with error code
>     > 1 in /tmp/pip-build-c8ofsvs6/kivy/
  • Eu também tentei com o cython 0.25.2
por user378625 16.01.2018 / 09:46

3 respostas

2

Ok, agora eu percebi esse problema. Isto é por causa da instalação de pacotes de cache pip eu tive pacotes quebrados cython e kivy no cache devido a isso toda vez que em vez de baixar um novo pip usa cache que já quebrou. E agora como esses pacotes quebraram por causa da troca da versão padrão do python sudo update-alternatives --config python3 aqui eu tinha setado o python3.6 default e baixei todos os pacotes mas algum trabalho interno do ubuntu (não sei) não suportam o python3.6 ele suporta python3 .5 devido a este download pacotes currept e vai para o cache e quando eu mudar para python3.5 ubuntu funciona muito bem, mas os pacotes tinham quebrado.

    
por user378625 16.01.2018 / 18:59
1

Em vez de pip tente apt:

 sudo add-apt-repository ppa:kivy-team/kivy
 sudo apt-get update
 sudo apt-get install python-kivy # or python3-kivy if you're using python3
    
por Mehdi Nellen 16.01.2018 / 18:39
0

Tente instalar pip install cython==0.25.0 e, em seguida, instale todos os requisitos de Kivy official install intructions .

It's possible that you can use newer version of cython, but last time when I tried with cython 0.26 and kivy 1.10 I had to downgrade cython.

    
por Qback 16.01.2018 / 10:14