Python3 용 파이 게임을 어떻게 구할 수 있습니까? 저장소에서 사용할 수있는 Python2 용

유니버스 저장소에서 사용할 수있는 Python2 용 패키지 (python-pygame)가 있습니다. 그러나 Invent with Python book 의 자습서를 통해 작업하고 싶습니다 . SPM (Synaptic)을 통해 Python3에 대한 파이 게임 리소스를 찾을 수 없습니다.

또한 Pygame 웹 사이트를 살펴본 결과 Python3에서 Pygame을 사용할 수 있는지 확실하지 않습니다 (책에 나와 있음).

누군가 내 딜레마를 도와 줄 수 있습니까?



답변

에서 파이 게임 위키 :

파이 게임은 파이썬 3에서 작동합니까?

예. Pygame 1.9.2는 Python 3.2 이상을 지원합니다. 고아 _movie 모듈 (기본적으로 빌드되지 않음) 만 그렇지 않습니다.

그러나 적어도 14.04 현재 우분투 저장소에는 Python 3 용 사전 패키지 Pygame 패키지가없는 것으로 보입니다.

pygame 웹 사이트에서 소스 패키지를 가져 와서 virtualenv 또는 buildout에 로컬로 설치하는 것이 좋습니다. 어쨌든 파이썬 모듈을 전 세계적으로 설치 🙂 다음 지침이 있습니다 : http://www.pygame.org/wiki/CompileUbuntu

또는이 PPA를 시도 할 수 있습니다 : https://launchpad.net/~thopiekar/+archive/ubuntu/pygame


답변


Thanks to Sergey's suggestion, this is how to get it working:
INSTALL
(1) Move to a directory where you want the source code to be downloaded to
(2) svn co svn://seul.org/svn/pygame/trunk pygame
    NOTE:  Be sure to use the svn method.  Simply downloading the pygame*.tar.gz
           file from the pygame downloads page didn't work!
(3) cd pygame
(4) python3 config.py
    NOTE:  This confirms that you have the dependencies.
(5) python3 setup.py build
(6) sudo python3 setup.py install
    NOTE:  On my machine, I have the distro's python3.2 installed (which is in
           the /usr/lib directory).  This step places the pygame module into
           /usr/local/lib -- which is what you want (per Sergey's suggestion).

TEST
(1) python3
(2) At the '>>>' prompt, type "import pygame"
    VALIDATION:  If you get another '>>>' prompt, all is well.

BlaXpirit에 따라 svn 대신 hg를 사용하도록 선택할 수도 있습니다.

hg clone https://bitbucket.org/pygame/pygame


답변

누군가 python3-pygame가 이것을 하는 패키지 를 만들어야 하지만 아직 아무도 없습니다.

sudo apt-get install mercurial python3-dev python3-numpy libav-tools \
    libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \
    libsdl1.2-dev  libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev
hg clone https://bitbucket.org/pygame/pygame
cd pygame
python3 setup.py build
sudo python3 setup.py install

답변

모두에게 다시 한번 감사드립니다.

Mint 18 Cinnamon 64bit를 새로 설치하고 Pygame을 다시 작동시키기 위해 TheGeek61의 게시물을 따라갔습니다.

그러나 내가 시도했을 때 python3 setup.py build오류가 발생했습니다.

Traceback (most recent call last):
  File "setup.py", line 109, in <module>
    from setuptools import setup, find_packages
ImportError: No module named 'setuptools'

일부 검색 후 다음을 실행하십시오.

sudo pip install -U setuptools

그런 다음 Pygame for Python3을 성공적으로 설치할 수있었습니다.


답변