import pygame时出现ImportError: DLL load failed: 找不到指定的模块,这怎么处理?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了import pygame时出现ImportError: DLL load failed: 找不到指定的模块,这怎么处理?相关的知识,希望对你有一定的参考价值。

D:\Python3\python.exe D:/新建文件夹/飞机大战/plane_main.py
Traceback (most recent call last):
File "D:/新建文件夹/飞机大战/plane_main.py", line 1, in <module>
import pygame
File "D:\Python3\lib\site-packages\pygame\__init__.py", line 130, in <module>
from pygame.base import *
ImportError: DLL load failed: 找不到指定的模块。

pycrypto模块好像是用命令python setup.py install安装
打开命令提示符,切换到解压后的crypto模块文件夹,输入命令

C:\python33\python setup.py install 回车
安装模块
参考技术A 兄弟,请问解决了吗

通过 pip 安装 PyGame 模块时出现问题 [关闭]

【中文标题】通过 pip 安装 PyGame 模块时出现问题 [关闭]【英文标题】:Problem installing the PyGame module via pip [closed] 【发布时间】:2020-10-19 19:42:48 【问题描述】:

我正在尝试为 Python 安装 pygame 模块,但我在回溯中收到以下错误:

pip install pygame

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3241, in <module>
    @_call_aside
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==20.1' distribution was not found and is required by the application
Juris-MacBook-Pro:~ j.alj0$ sudo pip3 install pygame
Password:
WARNING: The directory '/Users/j.alj0/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/j.alj0/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pygame
  Downloading https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz (3.2MB)
     |████████████████████████████████| 3.2MB 464kB/s 
Installing collected packages: pygame
  Running setup.py install for pygame ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-q0y248fw/pygame/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-q0y248fw/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/tmp/pip-record-0t79g4wb/install-record.txt --single-version-externally-managed --compile
         cwd: /private/tmp/pip-install-q0y248fw/pygame/
    Complete output (219 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/surfarray.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/sysfont.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/_camera_vidcapture.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/sndarray.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/version.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/compat.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/draw_py.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/colordict.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/ftfont.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/midi.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/cursors.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/font.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/_numpysndarray.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/sprite.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/macosx.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/_numpysurfarray.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/camera.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/freetype.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/_camera_opencv_highgui.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/pkgdata.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/locals.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    copying src_py/_dummybackend.py -> build/lib.macosx-10.9-x86_64-3.8/pygame
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/threads
    copying src_py/threads/Py25Queue.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/threads
    copying src_py/threads/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/threads
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/base_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/font_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/mixer_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/rwobject_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/pixelcopy_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/overlay_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/scrap_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/touch_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/imageext_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/pixelarray_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/draw_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/transform_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/blit_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/bufferproxy_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/surfarray_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/mouse_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/surfarray_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/event_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/imageext_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/sprite_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/touch_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/gfxdraw_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/rect_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/scrap_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/overlay_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/color_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/camera_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/surflock_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/key_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/sysfont_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/font_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/mixer_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/constants_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/mixer_music_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/sndarray_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/image_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/version_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/freetype_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/joystick_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/midi_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/ftfont_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/image__save_gl_surface_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/cdrom_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/cursors_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/fastevent_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/display_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/fastevent_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/compat_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/ftfont_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/cdrom_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/mask_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/midi_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/freetype_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/math_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/time_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/image_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/threads_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/__main__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/mixer_music_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/sndarray_tags.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/test_test_.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    copying test/surface_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/run_tests.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/endian.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/test_machinery.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/png.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/test_runner.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/arrinter.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/buftools.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    copying test/test_utils/async_sub.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/test_utils
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests
    copying test/run_tests__tests/run_tests__test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests
    copying test/run_tests__tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/fake_3_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/fake_4_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/fake_5_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/no_assertions__ret_code_of_1__test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/zero_tests_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    copying test/run_tests__tests/all_ok/fake_6_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/all_ok
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/failures1
    copying test/run_tests__tests/failures1/fake_3_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/failures1
    copying test/run_tests__tests/failures1/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/failures1
    copying test/run_tests__tests/failures1/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/failures1
    copying test/run_tests__tests/failures1/fake_4_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/failures1
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete
    copying test/run_tests__tests/incomplete/fake_3_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete
    copying test/run_tests__tests/incomplete/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete
    copying test/run_tests__tests/incomplete/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/infinite_loop
    copying test/run_tests__tests/infinite_loop/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/infinite_loop
    copying test/run_tests__tests/infinite_loop/fake_1_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/infinite_loop
    copying test/run_tests__tests/infinite_loop/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/infinite_loop
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stderr
    copying test/run_tests__tests/print_stderr/fake_3_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stderr
    copying test/run_tests__tests/print_stderr/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stderr
    copying test/run_tests__tests/print_stderr/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stderr
    copying test/run_tests__tests/print_stderr/fake_4_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stderr
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stdout
    copying test/run_tests__tests/print_stdout/fake_3_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stdout
    copying test/run_tests__tests/print_stdout/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stdout
    copying test/run_tests__tests/print_stdout/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stdout
    copying test/run_tests__tests/print_stdout/fake_4_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/print_stdout
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete_todo
    copying test/run_tests__tests/incomplete_todo/fake_3_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete_todo
    copying test/run_tests__tests/incomplete_todo/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete_todo
    copying test/run_tests__tests/incomplete_todo/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/incomplete_todo
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/exclude
    copying test/run_tests__tests/exclude/magic_tag_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/exclude
    copying test/run_tests__tests/exclude/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/exclude
    copying test/run_tests__tests/exclude/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/exclude
    copying test/run_tests__tests/exclude/invisible_tag_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/exclude
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/timeout
    copying test/run_tests__tests/timeout/sleep_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/timeout
    copying test/run_tests__tests/timeout/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/timeout
    copying test/run_tests__tests/timeout/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/timeout
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/everything
    copying test/run_tests__tests/everything/sleep_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/everything
    copying test/run_tests__tests/everything/magic_tag_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/everything
    copying test/run_tests__tests/everything/fake_2_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/everything
    copying test/run_tests__tests/everything/incomplete_todo_test.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/everything
    copying test/run_tests__tests/everything/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/tests/run_tests__tests/everything
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/docs
    copying docs/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/docs
    copying docs/__main__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/docs
    creating build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/playmus.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/mask.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/sound.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/overlay.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/aacircle.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/chimp.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/liquid.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/audiocapture.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/sound_array_demos.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/midi.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/scroll.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/cursors.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/moveit.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/blit_blends.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/testsprite.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/textinput.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/vgrade.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/arraydemo.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/stars.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/camera.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/blend_fill.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/fonty.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/headless_no_windows_needed.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/fastevents.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/prevent_display_stretching.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/glcube.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/aliens.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/freetype_misc.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/scaletest.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/video.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/eventlist.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/scrap_clipboard.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/oldalien.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/pixelarray.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    copying examples/dropevent.py -> build/lib.macosx-10.9-x86_64-3.8/pygame/examples
    running build_ext
    building 'pygame.gfxdraw' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/src_c
    creating build/temp.macosx-10.9-x86_64-3.8/src_c/SDL_gfx
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DENABLE_NEWBUF=1 -I/NEED_INC_PATH_FIX -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src_c/gfxdraw.c -o build/temp.macosx-10.9-x86_64-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 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-q0y248fw/pygame/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-q0y248fw/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/tmp/pip-record-0t79g4wb/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

谁能帮帮我?

【问题讨论】:

里面隐藏了一个很好的问题,但您需要格式化问题以提高可读性。请编辑您的问题并适当地使用标记语言。特别是,你需要使用```来包装代码块、回溯、命令输出等。 ***.com/questions/45992243/…的可能重复 【参考方案1】:

你的错误输出的相关位是

error: command 'gcc' failed with exit status 1

几乎可以肯定,您没有安装 gcc(GNU C 编译器)。这在 Python 模块中经常需要,因为其中许多是用 C 编写的 extension 模块,需要先编译。

我在谷歌上搜索“pip command 'gcc' failed with exit status 1”并找到了许多现有 *** 问题的链接。总是用谷歌搜索错误信息!

【讨论】:

嗯..我实际上是用谷歌搜索的。不过感谢您的帮助。【参考方案2】:

尝试做:

sudo easy_install-3.8 pygame

众所周知,pygame 通过pip 安装在 MacOS 上存在一些问题,正如 here 所讨论的那样。

【讨论】:

非常感谢!有效!至少我认为...无论如何谢谢! 很高兴我能帮上忙。那么您能否接受答案,以便以下搜索者看到这个? :)【参考方案3】:

我之前遇到过这个问题。您可能遇到以下两个问题之一:

    设置 pip 的路径,可能在 Python 的脚本文件夹中,并更新你的环境变量。

    在你的错误结束时,它会告诉你你有一个过时的 pip 版本。将其更新到最新版本为我解决了这个问题。

【讨论】:

很确定真正的错误是 OP 没有安装 gcc。 非常感谢!

以上是关于import pygame时出现ImportError: DLL load failed: 找不到指定的模块,这怎么处理?的主要内容,如果未能解决你的问题,请参考以下文章

通过 pip 安装 PyGame 模块时出现问题 [关闭]

安装pygame时出现这样是怎么回事?

使用 pygame.midi 播放 midi 音符时出现分段错误

cx_Freeze 将 Python 和 Pygame 文档编译为 .exe 文件时出现奇怪的错误

导入 ReactJS 时出现“未捕获的语法错误:无法在模块外使用 import 语句”

使用“import dateutil”和“dateutil.parser.parse()”时出现AttributeError,但使用“from dateutil import parser”时没有问题