python - Python3.8(Ubuntu 19.10)中的 pip 问题

标签 python linux pip pyaudio portaudio

当我下载 Ubuntu 19.10 并使用 pip 安装 python 3.8 时,遇到了这个问题。 我安装了一些模块,没有问题。但尝试安装 Kivy/PyoAudio/PyGame (也许它不是完整列表)是崩溃的。我在终端中可以看到:ERROR: Command errored out with exit status 1 .

如果有人知道如何解决这个问题,请写下我应该做什么。

PyAudio 示例:

ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_wk29gwp/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_wk29gwp/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ybexxyha/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-_wk29gwp/pyaudio/
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
    src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
       29 | #include "portaudio.h"
          |          ^~~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_wk29gwp/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_wk29gwp/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ybexxyha/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

PyGame 示例:

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

    Hunting dependencies...
    WARNING: "sdl-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.`   

最佳答案

它需要在您的系统上安装libsdl库开发版本。更多信息请访问https://wiki.libsdl.org/Installation

但似乎应该使用这个命令来工作

sudo apt-get install libsdl2-2.0

Debian-based systems (including Ubuntu) can simply do "sudo apt-get install libsdl2-2.0" to get the library installed system-wide, and all sorts of other useful dependencies, too.

此外,这种情况似乎还需要 portaudio19-dev (来自您发布的堆栈跟踪)。

sudo apt-get install portaudio19-dev

关于python - Python3.8(Ubuntu 19.10)中的 pip 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59523327/

相关文章:

python - 并行azure blob上传收到警告 'urllib3.connectionpool WARNING - Connection pool is full, discarding connection'

Python TCP 服务器,写入客户端?

Linux 使用 shell 移动或复制多个文件

c++ - C++ Linux GCC 应用程序中的 GUID

python -m pip install --upgrade pip 不起作用

python - 安装 pip python 时出现问题

python - 使用 http put 方法的 webapp2 有什么好的工作示例吗?

python - 在电报机器人中单击时如何更改内联按钮文本?

Python:如何测试我的包是否在 Linux、Mac 和 Windows 上运行

python - 当我安装了 OS X 10.11 时,为什么 pip 会为 OS X 10.12 安装 Pillow?