简体   繁体   English

在 Python 中安装 PyGame 时出错

[英]Errors when installing PyGame in Python

I am trying to make a Virtual Assistant and for that i am using PyGame but when i am trying to install PyGame am stuck with this errors, is there any way to get around?我正在尝试制作一个虚拟助手,为此我正在使用 PyGame 但是当我尝试安装 PyGame 时遇到此错误,有什么办法可以解决吗? I have tried everything but did not succeed我已经尝试了一切但没有成功

Errors -错误 -

Collecting PyAudio
  Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: PyAudio
  Building wheel for PyAudio (setup.py): started
  Building wheel for PyAudio (setup.py): finished with status 'error'
  Running setup.py clean for PyAudio
Failed to build PyAudio
Installing collected packages: PyAudio
  Running setup.py install for PyAudio: started
    Running setup.py install for PyAudio: finished with status 'error'

  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/PyAudio/setup.py'"'"'; __file__='"'"'/private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pip-wheel-u4fzx0xa --python-tag cp38
       cwd: /private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/PyAudio/
  Complete output (18 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.8
  copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.8
  warning: build_py: byte-compiling is disabled, skipping.

  running build_ext
  building '_portaudio' extension
  creating build/temp.macosx-10.9-x86_64-3.8
  creating build/temp.macosx-10.9-x86_64-3.8/src
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.8/src/_portaudiomodule.o
  src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
  #include "portaudio.h"
           ^~~~~~~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for PyAudio
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/PyAudio/setup.py'"'"'; __file__='"'"'/private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/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 /private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pip-record-xbb40_p1/install-record.txt --single-version-externally-managed --compile
         cwd: /private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/PyAudio/
    Complete output (18 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.8
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    building '_portaudio' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/src
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.8/src/_portaudiomodule.o
    src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
    #include "portaudio.h"
             ^~~~~~~~~~~~~
    1 error generated.
    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] = '"'"'/private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/PyAudio/setup.py'"'"'; __file__='"'"'/private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pycharm-packaging/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 /private/var/folders/4b/qbpxp4qj1cd8h1m1x1vd59xw0000gn/T/pip-record-xbb40_p1/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Please help me to resolve this errors请帮我解决这个错误

It seems like you're missing a dependency called portAudio.您似乎缺少一个名为 portAudio 的依赖项。 Try the following:尝试以下操作:

brew install portaudio

Brew installation guide in case you don't have it already如果您还没有 Brew 安装指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM