【问题标题】:Installing PyGame, difference between Python2.7 and 3.4?安装 PyGame,Python2.7 和 3.4 的区别?
【发布时间】:2015-07-08 02:04:41
【问题描述】:

我想使用 PyGame 模块,自然而然地开始安装它。由于 python 的默认版本是 2.7,我下载了(更早的)python 3.4 并且现在一直在使用它。在安装 PyGame 时,我在终端中输入以下命令: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,但是必须在同一种语言的两个版本之间切换仍然很乏味。

【问题讨论】:

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


    【解决方案1】:

    这对我有用:

    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>
    

    【讨论】:

      猜你喜欢
      • 2015-04-21
      • 1970-01-01
      • 2017-04-26
      • 2015-06-24
      • 1970-01-01
      • 2015-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多