지침에 따라 후 나는 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
생각?
답변
fatal error: Python.h: No such file or directory
Python 개발 (헤더) 패키지를 설치하지 않았 음을 나타냅니다. Python 2.7 (기본값)의 경우 python-dev에 포함되어 있습니다 .Python
3.2 버전의 경우 python3.2-dev 입니다. 이것은 Ubuntu 패키지에서 Python 3.2를 설치 한 경우에만 작동합니다.
설치 후 Python 패키지를 다시 설치하십시오.
새로운 오류 당신이지고있어,
error: could not create '/usr/local/lib/python3.2/dist-packages/pygame': Permission denied`
두 가지 이유 때문일 수 있습니다.
-
파이썬 virtualenv에서 일하고 있지 않습니다. virtualenv에서 작업하지 않고 시스템 폴더
/usr/local/
등에 설치하려고합니다 . 솔루션 : virtualenv로 올바르게 전환하십시오. 예를 들어 동일한 터미널 창에서 명령을workon <virtualenvname>
실행하십시오pip
.또는 virtualenvs로 작업하지 않으려는 경우 :
-
시스템 전체에 설치하려고하지만 그렇게 할 권한을 높이 지 않았습니다. 해결 방법 : 앞에 추가
pip
로 명령sudo
, 예를sudo pip install pygame