首页 > 解决方案 > 无法在 PyCharm 上启动 PyGame

问题描述

我能够将 PyCharm 安装到我的计算机上并安装了 Pygame 解释器,但是当我尝试启动该程序时,它显示以下内容:

Hello from the pygame community. https://www.pygame.org/contribute.html
2020-11-30 23:32:10.238 Python[56929:43313580] -[CAMetalLayer setDisplaySyncEnabled:]: unrecognized selector sent to instance 0x7f8424c483f0
2020-11-30 23:32:10.247 Python[56929:43313580] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAMetalLayer setDisplaySyncEnabled:]: unrecognized selector sent to instance 0x7f8424c483f0'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fffc2c932cb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fffd7abf48d objc_exception_throw + 48
    2   CoreFoundation                      0x00007fffc2d14f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x00007fffc2c05755 ___forwarding___ + 1061
    4   CoreFoundation                      0x00007fffc2c052a8 _CF_forwarding_prep_0 + 120
    5   libSDL2-2.0.dylib                   0x0000000107eb60d7 METAL_CreateRenderer + 2359
    6   libSDL2-2.0.dylib                   0x0000000107df872d SDL_CreateRenderer_REAL + 189
    7   libSDL2-2.0.dylib                   0x0000000107e73629 SDL_CreateWindowTexture + 457
    8   libSDL2-2.0.dylib                   0x0000000107e77a27 SDL_GetWindowSurface_REAL + 167
    9   display.cpython-37m-darwin.so       0x0000000108084713 pg_set_mode + 2179
    10  Python                              0x0000000107787b59 _PyMethodDef_RawFastCallKeywords + 681
    11  Python                              0x0000000107786f6a _PyCFunction_FastCallKeywords + 42
    12  Python                              0x0000000107847004 call_function + 724
    13  Python                              0x0000000107843fdd _PyEval_EvalFrameDefault + 25181
    14  Python                              0x0000000107847b63 _PyEval_EvalCodeWithName + 2467
    15  Python                              0x000000010783dca4 PyEval_EvalCode + 100
    16  Python                              0x000000010787b3b1 PyRun_FileExFlags + 209
    17  Python                              0x000000010787ac2a PyRun_SimpleFileExFlags + 890
    18  Python                              0x000000010789a0c3 pymain_main + 6915
    19  Python                              0x000000010789a62a _Py_UnixMain + 58
    20  libdyld.dylib                       0x00007fffd83f8235 start + 1
    21  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

谁能帮我解决这个问题?

标签: pythonpygamepycharm

解决方案


推荐阅读