錯誤:指令出錯,退出狀態為 1

錯誤:指令出錯,退出狀態為 1

嘗試使用安裝 pygamepip3安裝pygame在 Ubuntu 20.04 中我遇到了錯誤。感謝任何形式的幫助

我的錯誤看起來像這樣

ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9w9lq7il/pygame/setup.py'"'"'; file='"'"'/tmp/pip-install-9w9lq7il/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-install-9w9lq7il/pygame/pip-egg-info
         cwd: /tmp/pip-install-9w9lq7il/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.

答案1

sudo apt install libfreetype-dev libdsl2-dev

答案2

皮普具體抱怨:

/bin/sh: 1: sdl-config: not found

No package 'freetype2' found
/bin/sh: 1: freetype-config: not found

那麼,他們在哪裡?您可以嘗試使用 Google 搜索,但也可以安裝apt-file(如果尚未安裝):

sudo apt install apt-file

然後用它來尋找遺失的檔案。例如:

apt-file search "sdl-config"
apt-file search "freetype-config"

你會發現你需要安裝libfreetype-devlibdsl2-dev

相關內容