Instale o pygame em 12.04

1

Depois de seguir as instruções Como instalo o Pygame em virtualenv? ? , a execução de 'pip instalar pygame' agora retorna:

Downloading/unpacking pygame
Running setup.py egg_info for package pygame
Skipping module _numericsurfarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _numericsndarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module scrap for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _camera for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.

warning: no files found matching 'readme.txt'
no previously-included directories found matching '*/CVS'
no previously-included directories found matching '*/*/CVS'
Installing collected packages: pygame
Running setup.py install for pygame
Skipping module _numericsurfarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _numericsndarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module scrap for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _camera for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
building 'pygame.imageext' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -D_REENTRANT -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/usr/include -I/usr/include -I/usr/include/python3.2mu -c src/imageext.c -o build/temp.linux-x86_64-3.2/src/imageext.o
In file included from src/imageext.c:47:0:
src/pygame.h:75:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/david/.virtualenvs/pywork3/bin/python3.2 -c "import setuptools;__file__='/home/david/.virtualenvs/pywork3/build/pygame/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0tu3l3-record/install-record.txt --install-headers /home/david/.virtualenvs/pywork3/include/site/python3.2:
Skipping module _numericsurfarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

Skipping module _numericsndarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

Skipping module scrap for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

Skipping module _camera for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

running install

running build

running build_py

running build_ext

building 'pygame.imageext' extension

gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -D_REENTRANT -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/usr/include -I/usr/include -I/usr/include/python3.2mu -c src/imageext.c -o build/temp.linux-x86_64-3.2/src/imageext.o

In file included from src/imageext.c:47:0:

src/pygame.h:75:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/david/.virtualenvs/pywork3/bin/python3.2 -c "import setuptools;__file__='/home/david/.virtualenvs/pywork3/build/pygame/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0tu3l3-record/install-record.txt --install-headers /home/david/.virtualenvs/pywork3/include/site/python3.2 failed with error code 1 in /home/david/.virtualenvs/pywork3/build/pygame
Storing complete log in /home/david/.pip/pip.log

Pensamentos?

    
por David Y. Stephenson 26.06.2013 / 16:38

1 resposta

1

fatal error: Python.h: No such file or directory

Indica para mim que você não instalou o pacote de desenvolvimento (cabeçalhos) do Python. Para o Python 2.7 (o padrão), isso está incluído no python-dev , para a versão do Python 3.2, você parece estar usando isso é python3.2-dev .ObservequeissosófuncionarásevocêinstalouoPython3.2apartirdospacotesdoUbuntu.

Apósainstalação,tentenovamenteinstalaropacotedoPython.

O novo erro que você está recebendo ,

error: could not create '/usr/local/lib/python3.2/dist-packages/pygame': Permission denied'

pode ser por dois motivos:

  • Você não está trabalhando em um virtualenv do Python. Sem trabalhar em um virtualenv, ele tentará instalar nas pastas do sistema ( /usr/local/ etc.). Solução: mude para o virtualenv corretamente, por ex. workon <virtualenvname> e execute os comandos pip na mesma janela de terminal.

    OR , se você não pretende trabalhar com virtualenvs:

  • Você está tentando instalá-lo em todo o sistema, mas não elevou seus privilégios para isso. Solução: prefixar o comando pip com sudo , por exemplo,

    sudo pip install pygame
    
por gertvdijk 26.06.2013 / 16:42

Tags