尝试在MacOS 10.7.5上安装PyGame时出现错误代码1。
升级了setuptools,点到了最新版本。一样。 运行python 3.7。
Collecting pygame
Using cached https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
Building wheels for collected packages: pygame
Building wheel for pygame (setup.py) ... error
ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-install-le1w0xk3/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-wheel-ab9_asd7 --python-tag cp37:
ERROR: running bdist_w
running build_ext
building 'pygame.gfxdraw' extension
creating build/temp.macosx-10.6-intel-3.7
creating build/temp.macosx-10.6-intel-3.7/src_c
creating build/temp.macosx-10.6-intel-3.7/src_c/SDL_gfx
src_c/_pygame.h:216:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pygame
Running setup.py clean for pygame
Failed to build pygame
Installing collected packages: pygame
Running setup.py install for pygame ... error
ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-install-le1w0xk3/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/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-record-cwyl1pyo/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-install-le1w0xk3/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/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-record-cwyl1pyo/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-install-le1w0xk3/pygame/```
我是编程和python的新手,所以我真的不知道自己在做什么。另外,原始错误消息更长,但是我不得不将其缩减为张贴内容,因此可能缺少重要的内容。我遗忘了所有错误消息。
编辑:我尝试过'pip install pygame == 1.9.2'并获得
Using cached https://files.pythonhosted.org/packages/da/b8/b110cdea95452f8f9f9e79d02062fdccaebfd808a667d6d9a805ca8d222a/pygame-1.9.2.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR:
WARNING, No "Setup" File Exists, Running "config.py"
Using Darwin configuration...
/bin/sh: sdl-config: command not found
/bin/sh: sdl-config: command not found
/bin/sh: sdl-config: command not found
WARNING: "sdl-config" failed!
Hunting dependencies...
SDL : not found
Framework SDL not found
FONT : not found
Framework SDL_ttf not found
IMAGE : not found
Framework SDL_image not found
MIXER : not found
Framework SDL_mixer not found
Framework CoreMIDI found
Framework QuickTime found
PNG : not found
JPEG : not found
PORTMIDI: not found
FREETYPE: found 2.4.7
If you get compiler errors during install, doublecheck
the compiler flags in the "Setup" file.
Continuing With "setup.py"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-install-ktiwxsb8/pygame/setup.py", line 294, in <module>
write_version_module(METADATA['version'], revision)
File "/private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-install-ktiwxsb8/pygame/setup.py", line 286, in write_version_module
with open('version.py.in', 'r') as header_file:
FileNotFoundError: [Errno 2] No such file or directory: 'version.py.in'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/s_/7t3xwh7j2cg3s0wtbp8mr7p40000gn/T/pip-install-ktiwxsb8/pygame/
其他人给出了有关依赖项的答案,我认为这可能会对上面的错误代码有所帮助,因此我尝试“简单安装sdl sdl_image sdl_mixer sdl_ttf portmidi”并得到:
fatal: HTTP request failed
Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Library/Taps/homebrew/homebrew-core --config core.autocrlf=false --depth=1 -q
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
我不确定该怎么办,因为似乎到处都有错误。 我意识到解决问题可能非常简单,但是我不知道从哪里开始。感谢您阅读本文,希望您能对我有所帮助。