首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pip3安装游戏不起作用

Pip3安装游戏不起作用
EN

Stack Overflow用户
提问于 2018-08-10 19:45:49
回答 2查看 3.9K关注 0票数 0

我有一个Macbook运行OSX10.6,我正在尝试使用pip3安装玩偶来安装游戏。

使用python 3.7和pip 18.0。

下面是来自控制台的错误。

代码语言:javascript
复制
Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-install-ftjsil2g/pygame/setup.py", line 609, in <module>
        setup(**PACKAGEDATA)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run
        _build_ext.run(self)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 309, in run
        customize_compiler(self.compiler)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/sysconfig.py", line 170, in customize_compiler
        _osx_support.customize_compiler(_config_vars)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/_osx_support.py", line 418, in customize_compiler
        _find_appropriate_compiler(_config_vars)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/_osx_support.py", line 191, in _find_appropriate_compiler
        "Cannot locate working compiler")
    SystemError: Cannot locate working compiler
代码语言:javascript
复制
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-install-ftjsil2g/pygame/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-record-vgz3goci/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-install-ftjsil2g/pygame/

编辑:固定格式!

EN

回答 2

Stack Overflow用户

发布于 2018-08-10 19:59:49

因此,我并不完全理解您的错误消息是怎么回事,但我建议您查看本文,因为它涵盖了如何在MacOSX10.6-10.9上设置Pygame。

http://brysonpayne.com/2015/01/10/setting-up-pygame-on-a-mac/

如果上述方法不起作用,请按照下面的说明进行操作。

注意:我正在讨论每一步,所以跳过你已经做过的步骤。

步骤1:安装Python3和

在这里下载Python3.7:Python 3.7.0

运行安装程序并确保选择pip (我不记得这是否是可选的)。

步骤2:安装Pygame

运行下面的命令来使用pip安装pip:

代码语言:javascript
复制
python3 -m pip install -U pygame --user

步骤3:测试Pygame安装

运行此命令以测试Pygame是否正确安装:

代码语言:javascript
复制
python3 -m pygame.examples.aliens
票数 0
EN

Stack Overflow用户

发布于 2020-09-14 05:06:46

目前,即5/1/2020,您不能在python3.8中使用pip安装pygame来安装pygame库,但是您可以使用特定版本安装它们,仍然适用于dev.

您可以使用此版本在命令行中安装Python3.8:

代码语言:javascript
复制
*pip install pygame==2.0.0.dev6*

最新版本:

代码语言:javascript
复制
*pip install pygame==2.0.0.dev10*

你可以用终端机检查一下:

代码语言:javascript
复制
$ python3
>>import pygame
pygame 2.0.0.dev10 (SDL 2.0.12, python 3.8.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51793198

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档