我正在使用 Visual Studio 代码 python 并尝试安装 pyaudio 进行语音识别,但它不起作用。我已经尝试了所有可以在互联网上找到的方法,但仍然无法正常工作。这是我得到的错误:
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /Users/(myname)/.venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yr/ry42mhc57zx6rwv743hcd3cm0000gn/T/pip-install-x169uf9a/pyaudio_e3aaab579ae54e1f8536fa48ae519726/setup.py'"'"'; __file__='"'"'/private/var/folders/yr/ry42mhc57zx6rwv743hcd3cm0000gn/T/pip-install-x169uf9a/pyaudio_e3aaab579ae54e1f8536fa48ae519726/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/yr/ry42mhc57zx6rwv743hcd3cm0000gn/T/pip-record-rbu8r5rx/install-record.txt --single-version-externally-managed --compile --install-headers /Users/(myname)/.venv/include/site/python3.8/pyaudio
cwd: /private/var/folders/yr/ry42mhc57zx6rwv743hcd3cm0000gn/T/pip-install-x169uf9a/pyaudio_e3aaab579ae54e1f8536fa48ae519726/
Complete output (104 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14.6-x86_64-3.8
copying src/pyaudio.py -> build/lib.macosx-10.14.6-x86_64-3.8
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.14.6-x86_64-3.8
creating build/temp.macosx-10.14.6-x86_64-3.8/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic - error: Unsupported architecture
#error Unsupported architecture
^
In file included from src/_portaudiomodule.c:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_stdio.h:71:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
In file included from src/_portaudiomodule.c:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from
^
note: '__uint128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */
^
note: '__int128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_uid_t; /* [???] user IDs */
^
note: '__uint128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */
^
note: '__uint128_t' declared here
In file included from src/_portaudiomodule.c:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_stdio.h:71:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_wctype_t;
^
note: '__uint128_t' declared here
In file included from src/_portaudiomodule.c:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_stdio.h:75:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types/_va_list.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
#error architecture not supported
^
In file included from src/_portaudiomodule.c:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_stdio.h:75:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types/_va_list.h:32:9: error: unknown type name '__darwin_va_list'
typedef __darwin_va_list va_list;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/(myname)/.venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yr/ry42mhc57zx6rwv743hcd3cm0000gn/T/pip-install-x169uf9a/pyaudio_e3aaab579ae54e1f8536fa48ae519726/setup.py'"'"'; __file__='"'"'/private/var/folders/yr/ry42mhc57zx6rwv743hcd3cm0000gn/T/pip-install-x169uf9a/pyaudio_e3aaab579ae54e1f8536fa48ae519726/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/yr/ry42mhc57zx6rwv743hcd3cm0000gn/T/pip-record-rbu8r5rx/install-record.txt --single-version-externally-managed --compile --install-headers /Users/(myname)/.venv/include/site/python3.8/pyaudio Check the logs for full command output.
这似乎是一堆随机代码,我是相当新的自学成才,所以我很迷茫。我也尝试使用 brew ,我看到很多人说要这样做,但这也不起作用。如果有人可以提供帮助,那就太好了:))