Installation Pip3安装pygame不工作
我有一台运行OS X 10.6的Macbook,我正在尝试使用pip3安装pygame来安装pygame 使用Python3.7和PIP18.0 下面是来自控制台的错误Installation Pip3安装pygame不工作,installation,pip,pygame,Installation,Pip,Pygame,我有一台运行OS X 10.6的Macbook,我正在尝试使用pip3安装pygame来安装pygame 使用Python3.7和PIP18.0 下面是来自控制台的错误 Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-i
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
编辑:固定格式 所以我不完全理解你的错误消息是怎么回事,但我建议你看看这篇文章,因为它很好地介绍了在Mac OSX 10.6-10.9上设置Pygame 如果上述操作不起作用,请按照下面的说明操作
注意:我将涵盖每一步,因此只需跳过您已经完成的步骤 步骤1:安装Python 3和Pip 在此处下载Python 3.7: 运行安装程序并确保选择pip(我不记得这是否是可选的) 步骤2:安装Pygame 运行以下命令以使用pip安装Pygame:
python3 -m pip install -U pygame --user
步骤3:测试Pygame安装
运行此命令以测试Pygame是否正确安装:
python3 -m pygame.examples.aliens
目前,即2020年5月1日,您无法使用pip install pygame在python 3.8中安装pygame库,但您可以使用特定版本的pygame库进行安装,仍然适用于开发人员。 您可以使用以下版本在命令行中安装Python 3.8:
*pip install pygame==2.0.0.dev6*
最新版本:
*pip install pygame==2.0.0.dev10*
你可以和我核对一下
终端:
$ 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
你安装了Python3和pip3吗?Mac OSX仅随Python2.7提供。我认为python3有时会随pip3提供,但如果您在安装程序中使用Python.org的安装程序,那么它会提供,但在Linux中的命令行上,例如,有时您还需要下载pip-separate.run
python3-v
和pip3-v
来检查您的版本。也可能是因为路径中没有python3。还可以设置错误消息的格式。只需选择它们并按ctrl+k键即可。在当前的格式下,它们很难读取。我无法获得Xcode,因为我的操作系统太旧了,而且我也无法获得自制。这就是所发生的情况:-表达式中的e:1:Invalid char\342'-表达式中的e:1:Invalid char
\200'-表达式中的e:1:Invalid char`\234'-当我尝试python3-m pip install-U pygame-用户时,它与我问题中的错误相同,这很奇怪,我只是在自己的机器上完成了这些步骤,它对我起了作用。还要再次检查一下,您的路径中有/Library/Frameworks/Python.framework/Versions/3.7/bin
?实际上我没有它,所以我只是添加了它,但它仍然不能让我们工作。
$ 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