微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PyGame安装:错误:命令错误,退出状态为1:

如何解决PyGame安装:错误:命令错误,退出状态为1:

一些前体信息:

操作系统:Ubuntu 20.04.1 LTS

Python版本: Python 3.8.5

IDE: PyCharm 2020.2.3(社区版)

我正在使用virtualenv。

问题:

我正在尝试使用official documentation和以下命令来安装pygame

python3 -m pip install -U pygame

(我尝试了不同的变体,例如,没有-U,带有--user等),我得到了错误

ERROR: Command errored out with exit status 1:
     command: /home/GBean/DropBox/Projects/Python/Snake/venv/bin/python -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cghwhw8a/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cghwhw8a/pygame/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 /tmp/pip-pip-egg-info-lo7hoty9
         cwd: /tmp/pip-install-cghwhw8a/pygame/
    Complete output (29 lines):
    
    
    WARNING,No "Setup" File Exists,Running "buildconfig/config.py"
    Using UNIX configuration...
    
    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found
    Package freetype2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `freetype2.pc'
    to the PKG_CONfig_PATH environment variable
    No package 'freetype2' found
    Package freetype2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `freetype2.pc'
    to the PKG_CONfig_PATH environment variable
    No package 'freetype2' found
    Package freetype2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `freetype2.pc'
    to the PKG_CONfig_PATH environment variable
    No package 'freetype2' found
    /bin/sh: 1: freetype-config: not found
    /bin/sh: 1: freetype-config: not found
    /bin/sh: 1: freetype-config: not found
    
    Hunting dependencies...
    WARNING: "sdl-config" Failed!
    WARNING: "pkg-config freetype2" Failed!
    WARNING: "freetype-config" Failed!
    Unable to run "sdl-config". Please make sure a development version of SDL is installed.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我尝试过更新pipsetuptools,但运气不好,

例如https://github.com/facebook/prophet/issues/418

如果有人能指出正确的方向来解决这个问题,我将不胜感激。谢谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。