Установите Pygame на 12.04

После следования инструкциям Как установить Pygame в virtualenv? , запуск `pip install pygame 'теперь возвращает:

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

Мысли?

1
задан 13 April 2017 в 15:23

1 ответ

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

Указывает мне, что Вы не установили разработку Python (заголовки) пакет. Для Python 2.7 (значение по умолчанию), это включено в python-dev Install python-devдля версии Python 3.2, которую Вы, кажется, используете, это - python3.2-devInstall python3.2-dev. Обратите внимание, что это будет только работать при установке Python 3.2 от пакетов Ubuntu.

После установки попробуйте еще раз устанавливать пакет Python.


Новая ошибка Вы добираетесь,

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

мог быть из-за двух причин:

  • Вы не работаете в Python virtualenv. Не работая в virtualenv, это попытается установить в системных папках (/usr/local/ и т.д.). Решение: переключитесь на virtualenv правильно, например. workon <virtualenvname> и выполненный pip команды в том же окне терминала.

    ИЛИ, если Вы не намереваетесь работать с virtualenvs:

  • Вы пытаетесь установить его в масштабе всей системы, но Вы не подняли свои полномочия сделать так. Решение: предварительно ожидайте pip команда с sudo, например.

    sudo pip install pygame
    
1
ответ дан 13 April 2017 в 15:23

Другие вопросы по тегам:

Похожие вопросы: