【问题标题】:unable to install pygame_sdl2 via pip无法通过 pip 安装 pygame_sdl2
【发布时间】:2019-03-04 15:57:09
【问题描述】:

我正在尝试在我的 ubuntu 平台上安装 pygame-sdl2

当我在终端上运行命令:pip install -i https://test.pypi.org/simple/ pygame_sdl2 时出现此错误:

Looking in indexes: https://test.pypi.org/simple/
Collecting pygame_sdl2
  Using cached https://test-files.pythonhosted.org/packages/2f/f1/8dd343ae2d97c432cf1c81ca03d2d0472396f9d8e76c677aeae9ce2ec61d/pygame_sdl2-2.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    sh: 1: sdl2-config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-tXTEZE/pygame-sdl2/setup.py", line 39, in <module>
        parse_cflags([ "sh", "-c", "sdl2-config --cflags" ])
      File "setuplib.py", line 93, in parse_cflags
        output = subprocess.check_output(command, universal_newlines=True)
      File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['sh', '-c', 'sdl2-config --cflags']' returned non-zero exit status 127

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-tXTEZE/pygame-sdl2/

【问题讨论】:

  • Can't install pygame_sdl2的可能重复
  • 不,这是别的东西(我之前读过但没有解决我的问题)这是关于 sdl2-config 文件
  • @YoucefBenyettou 这与windows依赖有关,这里是针对ubuntu的

标签: python ubuntu pip pygame sdl-2


【解决方案1】:

https://github.com/renpy/pygame_sdl2#building

要从源代码编译 pygame_sdl2,您需要 SDL2、SDL2_gfx、SDL2_image、SDL2_mixer 和 SDL2_ttf 库。

sudo apt-get install build-essential python-dev libsdl2-dev \
    libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
    libjpeg-dev libpng-dev

【讨论】:

  • 我之前已经尝试过很多次了,但是它给出了错误 not found[404] packages not installed try apt-get update 或 --fix-missing。终端无法获取 URL :(
  • 唯一不在 Debian 中的软件包是 libpng12-dev。说明好像有点过时了,目前的包是libpng-dev
  • 我已经想通了;我的错误是这样的:Err:1 fr.archive.ubuntu.com/ubuntu zesty/main amd64 libpcrecpp0v5 amd64 2:8.39-3 404 Not Found [IP: 194.158.119.186 80] Err:2 fr.archive.ubuntu.com/ubuntuzesty-updates/main amd64 libudev-dev amd64 232-21ubuntu3 404 Not Found [IP:194.158.119.186 80] Err:3 fr.archive.ubuntu.com/ubuntuzesty/main amd64 libdbus-1-dev amd64 1.10.10- 1ubuntu2 404 未找到 [IP: 194.158.119.186 80]
  • 与问题无关。问题是你已经配置apt使用fr.archive.ubuntu.com/ubuntu作为包镜像但是镜像已经过时了,fr.archive.ubuntu.com/ubuntu/dists没有热情修复你的/etc/apt/sources.list
  • 我应该怎么做才能修复它?
猜你喜欢
  • 1970-01-01
  • 2016-05-18
  • 2021-04-21
  • 2017-02-08
  • 2019-06-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多