安装PyGame,Python2.7和3.4之间的区别?

时间:2015-04-29 01:11:02

标签: python python-2.7 python-3.x pygame pip

我想使用PyGame模块,当然,还是要安装它。由于python的默认版本是2.7,我下载(更早)python 3.4并且现在一直在使用它。安装PyGame时,我在Terminal中输入以下命令:python3.4 -m pip install hg+http://bitbucket.org/pygame/pygame

正如您所看到的,我在这里使用pipmercurial来帮助我。

当尝试使用上面的命令安装PyGame时,安装似乎开始但返回以下错误:

WARNING, No "Setup" File Exists, Running "config.py"
Using Darwin configuration...

/bin/sh: smpeg-config: command not found
/bin/sh: smpeg-config: command not found
/bin/sh: smpeg-config: command not found
/bin/sh: /usr/X11R6/bin/freetype-config: No such file or directory
/bin/sh: /usr/X11R6/bin/freetype-config: No such file or directory
/bin/sh: /usr/X11R6/bin/freetype-config: No such file or directory
WARNING: "smpeg-config" failed!
WARNING: "/usr/X11R6/bin/freetype-config" failed!
Hunting dependencies...
SDL     : found 1.2.15
Framework SDL not found
FONT    : found
Framework SDL_ttf not found
IMAGE   : found
Framework SDL_image not found
MIXER   : found
Framework SDL_mixer not found
SMPEG   : not found
Framework smpeg not found
Framework CoreMIDI found
Framework QuickTime found
PNG     : found
JPEG    : found
PORTMIDI: found
FREETYPE: not found
AVFORMAT: not found
SWSCALE : not found

If you get compiler errors during install, doublecheck
the compiler flags in the "Setup" file.


Continuing With "setup.py"
Skipping module _numericsurfarray for Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  5 2014, 20:42:22)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] build.
Skipping module _numericsndarray for Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  5 2014, 20:42:22)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] build.

no previously-included directories found matching '*/CVS'
no previously-included directories found matching '*/*/CVS'

我以前通过终端安装了依赖项,但它们是否只能安装python 2.7而python3.4不能识别它们? (我不知道这是否是一个有效的建议,因为这种类型的东西不是我的专业领域)

我进入Python3.4(交互模式)并导入PyGame工作(但我想我无法使用所有模块的功能)。

但是,当我使用默认的python(2.7)在终端上运行相同的命令时,它会成功安装:

    sudo pip install hg+http://bitbucket.org/pygame/pygame
Password:
Collecting hg+http://bitbucket.org/pygame/pygame
  Cloning hg http://bitbucket.org/pygame/pygame to /tmp/pip-q1scmd-build
Installing collected packages: pygame
  Running setup.py install for pygame
Successfully installed pygame-1.9.2a0

有人可以提出差异的原因吗?我想在制作游戏时我可以使用python2.7,但是必须在同一种语言的两个版本之间切换仍然很乏味。

1 个答案:

答案 0 :(得分:0)

这对我有用:

https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=33157

<pre>

$ sudo apt-get install mercurial 
$ hg clone https://bitbucket.org/pygame/pygame
$ cd pygame

$ sudo apt-get install libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev 
$ sudo apt-get install libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev
$ sudo apt-get install python3-dev python3-numpy

$ python3 setup.py build 
$ sudo python3 setup.py install

</pre>
相关问题