当我想将 pygame 1.9.x 安装到 python 3 时发生错误

问题描述

我需要 1.9.x pygame 版本,当我尝试安装它时会出现不同的错误。当我尝试安装 1.9.3 时,错误是:

  Using cached pygame-1.9.3.tar.gz (3.0 MB)
    ERROR: Command errored out with exit status 1:
     command: 'd:\programs\python\python.exe' -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Users\\abdra\\AppData\\Local\\Temp\\pip-install-d5bfgpnx\\pygame_7d1e8884adcf485e91bedcae7af095c1\\setup.py'"'"'; __file__='"'"'C:\\Users\\abdra\\AppData\\Local\\Temp\\pip-install-d5bfgpnx\\pygame_7d1e8884adcf485e91bedcae7af095c1\\setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\abdra\AppData\Local\Temp\pip-pip-egg-info-rwrf47a6'
         cwd: C:\Users\abdra\AppData\Local\Temp\pip-install-d5bfgpnx\pygame_7d1e8884adcf485e91bedcae7af095c1\
    Complete output (34 lines):


    WARNING,No "Setup" File Exists,Running "config.py"
    Using WINDOWS configuration...

    Path for SDL not found.
    Too bad that is a requirement! Hand-fix the "Setup"
    Path for FONT not found.
    Path for IMAGE not found.
    Path for mixer not found.
    Path for PNG not found.
    Path for JPEG not found.
    Path for PORTMIDI not found.
    Path for copYLIB_tiff not found.
    Path for copYLIB_z not found.
    Path for copYLIB_vorbis not found.
    Path for copYLIB_ogg not found.

    If you get compiler errors during install,doublecheck
    the compiler flags in the "Setup" file.

    Traceback (most recent call last):
      File "<string>",line 1,in <module>
      File "C:\Users\abdra\AppData\Local\Temp\pip-install-d5bfgpnx\pygame_7d1e8884adcf485e91bedcae7af095c1\setup.py",line 165,in <module>
        extensions = read_setup_file('Setup')
      File "d:\programs\python\lib\distutils\extension.py",line 171,in read_setup_file
        line = expand_makefile_vars(line,vars)
      File "d:\programs\python\lib\distutils\sysconfig.py",line 430,in expand_makefile_vars
        s = s[0:beg] + vars.get(m.group(1)) + s[end:]
    TypeError: can only concatenate str (not "nonetype") to str

    Continuing With "setup.py"
    Error with the "Setup" file,perhaps make a clean copy from "Setup.in".
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

但是当我尝试安装 1.9.6 时,错误是:

Collecting pygame==1.9.6
  Using cached pygame-1.9.6.tar.gz (3.2 MB)
    ERROR: Command errored out with exit status 1:
     command: 'd:\programs\python\python.exe' -c 'import sys,tokenize; sys.argv[0] = '"'"'C:\\Users\\abdra\\AppData\\Local\\Temp\\pip-install-z6bvpoua\\pygame_050e29a5f2b740d5b635ff8cc3e8e789\\setup.py'"'"'; __file__='"'"'C:\\Users\\abdra\\AppData\\Local\\Temp\\pip-install-z6bvpoua\\pygame_050e29a5f2b740d5b635ff8cc3e8e789\\setup.py'"'"';f=getattr(tokenize,'"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\abdra\AppData\Local\Temp\pip-pip-egg-info-n4viyg0i'
         cwd: C:\Users\abdra\AppData\Local\Temp\pip-install-z6bvpoua\pygame_050e29a5f2b740d5b635ff8cc3e8e789\
    Complete output (17 lines):


    WARNING,Running "buildconfig/config.py"
    Using WINDOWS configuration...


    Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
      File "<string>",in <module>
      File "C:\Users\abdra\AppData\Local\Temp\pip-install-z6bvpoua\pygame_050e29a5f2b740d5b635ff8cc3e8e789\setup.py",line 194,in <module>
        buildconfig.config.main(AUTO_CONfig)
      File "C:\Users\abdra\AppData\Local\Temp\pip-install-z6bvpoua\pygame_050e29a5f2b740d5b635ff8cc3e8e789\buildconfig\config.py",line 210,in main
        deps = CFG.main(**kwds)
      File "C:\Users\abdra\AppData\Local\Temp\pip-install-z6bvpoua\pygame_050e29a5f2b740d5b635ff8cc3e8e789\buildconfig\config_win.py",line 576,in main
        and download_win_prebuilt.ask(**download_kwargs):
      File "C:\Users\abdra\AppData\Local\Temp\pip-install-z6bvpoua\pygame_050e29a5f2b740d5b635ff8cc3e8e789\buildconfig\download_win_prebuilt.py",line 302,in ask
        reply = raw_input(
    EOFError: EOF when reading a line
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我尝试安装它们的方式 pip install -U pygame==1.9.6pip install -U pygame==1.9.3。我在 python 3.6、3.7、3.8 和 3.9 上尝试过,到处都是相同的错误。我在 SOF 上发现了很多相同的问题,但没有任何帮助。谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)