安装PyGame时出现问题。

2024-05-29 03:40:14 发布

您现在位置:Python中文网/ 问答频道 /正文

这个问题已经困扰了我好几个小时了。 我使用的是OSXYosemite,我的想法是开始用Python和PyGame一起开发游戏。你知道吗

我想在python3.x而不是2.x中使用PyGame

不管怎样。。我遵循了大量的说明如何下载和安装,但不幸的是,结果我没有运气。 PyGame的一个官方指南guide也不起作用。 我使用了this tutorial,下面出现了这些特殊的问题/错误。你知道吗

请注意,我已下载并安装:

  • 用于Xcode(7.2)的命令行工具10.10,来自here

  • 来自here的XQuartz

  • 自酿自here

  • Python 3.4

Python版本?: enter image description here

mercurial软件包在安装时无法工作,显然存在一些错误。。你知道吗

安装mercurial: enter image description here

测试是否有效: enter image description here

在hg文件中:

#!/usr/local/bin/python3.4
#
# mercurial - scalable distributed SCM
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

import os
import sys

if os.environ.get('HGUNICODEPEDANTRY', False):
    reload(sys)
    sys.setdefaultencoding("undefined")


libdir = '../lib/python3.4/site-packages/'

if libdir != '@' 'LIBDIR' '@':
    if not os.path.isabs(libdir):
        libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                              libdir)
        libdir = os.path.abspath(libdir)
    sys.path.insert(0, libdir)

# enable importing on demand to reduce startup time
try:
    from mercurial import demandimport; demandimport.enable()
except ImportError:
    import sys
    sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
                     ' '.join(sys.path))
    sys.stderr.write("(check your install and PYTHONPATH)\n")
    sys.exit(-1)

import mercurial.util
import mercurial.dispatch

for fp in (sys.stdin, sys.stdout, sys.stderr):
    mercurial.util.setbinary(fp)

mercurial.dispatch.run()

在文件夹中:/usr/local/Cellar/mercurial/3.8.3/lib/python3.4/site-packages

enter image description here

文件夹内:/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages包 enter image description here

请务必注意,我已更改并添加了一些文件到不同的路径等


Tags: 文件pathimportifhereoslibpackages

热门问题