Pygame pip Macos 安装错误:命令“clang”失败,退出状态为 1

时间:2021-05-22 16:37:01

标签: python macos pip pygame

作为网络开发人员,我是 Python 库的新手。我想安装 pygame,但出现错误: 错误:命令“clang”失败,退出状态为 1 我以前从未见过这个问题,所以这是我最后的希望。 这是完整的错误:

Last login: Sat May 22 11:58:03 on ttys000
Trevors-Air ~ % sudo pip install pygame                         
Password:
WARNING: The directory '/Users/trevor/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting pygame
  Downloading pygame-2.0.1.tar.gz (5.5 MB)
     |████████████████████████████████| 5.5 MB 1.6 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-ajazyi4n/pygame_ba4907752abf40b3b163c0bdd62be2e5/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-ajazyi4n/pygame_ba4907752abf40b3b163c0bdd62be2e5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-pip-egg-info-mfq5uv4h
         cwd: /private/tmp/pip-install-ajazyi4n/pygame_ba4907752abf40b3b163c0bdd62be2e5/
    Complete output (27 lines):
    
    
    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using Darwin configuration...
    
    /bin/sh: sdl2-config: command not found
    /bin/sh: sdl2-config: command not found
    /bin/sh: sdl2-config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-install-ajazyi4n/pygame_ba4907752abf40b3b163c0bdd62be2e5/setup.py", line 318, in <module>
        buildconfig.config.main(AUTO_CONFIG)
      File "/private/tmp/pip-install-ajazyi4n/pygame_ba4907752abf40b3b163c0bdd62be2e5/buildconfig/config.py", line 221, in main
        deps = CFG.main(**kwds)
      File "/private/tmp/pip-install-ajazyi4n/pygame_ba4907752abf40b3b163c0bdd62be2e5/buildconfig/config_darwin.py", line 131, in main
        [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
      File "/private/tmp/pip-install-ajazyi4n/pygame_ba4907752abf40b3b163c0bdd62be2e5/buildconfig/config_unix.py", line 39, in __init__
        self.ver = config[0].strip()
    IndexError: list index out of range
    
    ---
    For help with compilation see:
        https://www.pygame.org/wiki/MacCompile
    To contribute to pygame development see:
        https://www.pygame.org/contribute.html
    ---
    
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/c7/b8/06e02c7cca7aec915839927a9aa19f749ac17a3d2bb2610b945d2de0aa96/pygame-2.0.1.tar.gz#sha256=8b1e7b63f47aafcdd8849933b206778747ef1802bd3d526aca45ed77141e4001 (from https://pypi.org/simple/pygame/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading pygame-2.0.0.tar.gz (5.5 MB)
     |████████████████████████████████| 5.5 MB 4.4 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-ajazyi4n/pygame_fc85f1a3453f428297bc017bd3320d49/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-ajazyi4n/pygame_fc85f1a3453f428297bc017bd3320d49/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-pip-egg-info-0diva0m5
         cwd: /private/tmp/pip-install-ajazyi4n/pygame_fc85f1a3453f428297bc017bd3320d49/
    Complete output (27 lines):
    
    
    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using Darwin configuration...
    
    /bin/sh: sdl2-config: command not found
    /bin/sh: sdl2-config: command not found
    /bin/sh: sdl2-config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-install-ajazyi4n/pygame_fc85f1a3453f428297bc017bd3320d49/setup.py", line 318, in <module>
        buildconfig.config.main(AUTO_CONFIG)
      File "/private/tmp/pip-install-ajazyi4n/pygame_fc85f1a3453f428297bc017bd3320d49/buildconfig/config.py", line 221, in main
        deps = CFG.main(**kwds)
      File "/private/tmp/pip-install-ajazyi4n/pygame_fc85f1a3453f428297bc017bd3320d49/buildconfig/config_darwin.py", line 131, in main
        [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
      File "/private/tmp/pip-install-ajazyi4n/pygame_fc85f1a3453f428297bc017bd3320d49/buildconfig/config_unix.py", line 39, in __init__
        self.ver = config[0].strip()
    IndexError: list index out of range
    
    ---
    For help with compilation see:
        https://www.pygame.org/wiki/MacCompile
    To contribute to pygame development see:
        https://www.pygame.org/contribute.html
    ---
    
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/bc/0c/d164411381bada8feae57359aa9296defbed3035f4b55bef6a271cb0573c/pygame-2.0.0.tar.gz#sha256=63b038da116a643046181b02173fd894d87d2f85ecfd6aa7d5ece73c6ef501e9 (from https://pypi.org/simple/pygame/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading pygame-1.9.6.tar.gz (3.2 MB)
     |████████████████████████████████| 3.2 MB 1.8 MB/s 
Building wheels for collected packages: pygame
  Building wheel for pygame (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/tmp/pip-wheel-q52rvyt5
       cwd: /private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/
  Complete output (218 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14.6-arm64-3.8
  creating build/lib.macosx-10.14.6-arm64-3.8/pygame
  copying src_py/surfarray.py -> build/lib.macosx-10.14.6-arm64-3.8/pygame
  //took some info out here that was copying
  copying src_py/sysfont.py -> build/lib.macosx-10.14.6-arm64-
  running build_ext
  building 'pygame.gfxdraw' extension
  creating build/temp.macosx-10.14.6-arm64-3.8
  creating build/temp.macosx-10.14.6-arm64-3.8/src_c
  creating build/temp.macosx-10.14.6-arm64-3.8/src_c/SDL_gfx
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DENABLE_NEWBUF=1 -I/NEED_INC_PATH_FIX -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c src_c/gfxdraw.c -o build/temp.macosx-10.14.6-arm64-3.8/src_c/gfxdraw.o
  In file included from src_c/gfxdraw.c:33:
  In file included from src_c/pygame.h:32:
  src_c/_pygame.h:216:10: fatal error: 'SDL.h' file not found
  #include <SDL.h>
           ^~~~~~~
  1 error generated.
  ---
  For help with compilation see:
      https://www.pygame.org/wiki/MacCompile
  To contribute to pygame development see:
      https://www.pygame.org/contribute.html
  ---
  error: command '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: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-9_g3jz7k/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Python/3.8/include/pygame
         cwd: /private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/
    Complete output (218 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14.6-arm64-3.8
    creating build/lib.macosx-10.14.6-arm64-3.8/pygame
    copying src_py/surfarray.py -> build/lib.macosx-10.14.6-arm64-3.8/pygame
  //i took some info out here thats just copying
    building 'pygame.gfxdraw' extension
    creating build/temp.macosx-10.14.6-arm64-3.8
    creating build/temp.macosx-10.14.6-arm64-3.8/src_c
    creating build/temp.macosx-10.14.6-arm64-3.8/src_c/SDL_gfx
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DENABLE_NEWBUF=1 -I/NEED_INC_PATH_FIX -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c src_c/gfxdraw.c -o build/temp.macosx-10.14.6-arm64-3.8/src_c/gfxdraw.o
    In file included from src_c/gfxdraw.c:33:
    In file included from src_c/pygame.h:32:
    src_c/_pygame.h:216:10: fatal error: 'SDL.h' file not found
    #include <SDL.h>
             ^~~~~~~
    1 error generated.
    ---
    For help with compilation see:
        https://www.pygame.org/wiki/MacCompile
    To contribute to pygame development see:
        https://www.pygame.org/contribute.html
    ---
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-ajazyi4n/pygame_db05fbb0f42f497bbe730f635b783b48/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-9_g3jz7k/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Python/3.8/include/pygame Check the logs for full command output.
@Trevors-Air ~ % 

这是我第一次安装库,所以我只安装了 pip。如果需要,我可以安装其他任何东西!

0 个答案:

没有答案
相关问题