在 MSYS2 上安装 pyaudio(损坏的 c 文件)
Install pyaudio on MSYS2 (broken c files)
我正在尝试在新机器上的 MSYS2/MingGW64 中安装 pyaudio python 模块。
Χρήστος Παππάς@DESKTOP-8T1C1VF MSYS /c/Users/Χρήστος Παππάς/Documents/projects/Papinhio player/Αρχεία πηγαίου κώδικα εφαρμογής (python)
$ cd ../Σημειώσεις\ και\ βιβλιοθήκες\ \(notes\)/
Χρήστος Παππάς@DESKTOP-8T1C1VF MSYS /c/Users/Χρήστος Παππάς/Documents/projects/Papinhio player/Σημειώσεις και βιβλιοθήκες (notes)
$ cd PyAudio-0.2.11/
Χρήστος Παππάς@DESKTOP-8T1C1VF MSYS /c/Users/Χρήστος Παππάς/Documents/projects/Papinhio player/Σημειώσεις και βιβλιοθήκες (notes)/PyAudio-0.2.11
$ python setup.py build
running build
running build_py
running build_ext
building '_portaudio' extension
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -I/usr/include/python3.9 -c src/_portaudiomodule.c -o build/temp.msys-3.2.0-x86_64-3.9/src/_portaudiomodule.o
In file included from src/_portaudiomodule.c:27:
/usr/local/include/stdio.h:1258:18: error: expected ‘,’ or ‘;’ before ‘fgetwc’
1258 | wint_t __cdecl fgetwc(FILE *_File);
| ^~~~~~
/usr/local/include/stdio.h:1259:26: error: expected ‘,’ or ‘;’ before ‘_fgetwchar’
1259 | _CRTIMP wint_t __cdecl _fgetwchar(void);
| ^~~~~~~~~~
/usr/local/include/stdio.h:1260:18: error: expected ‘,’ or ‘;’ before ‘fputwc’
1260 | wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
| ^~~~~~
/usr/local/include/stdio.h:1261:26: error: expected ‘,’ or ‘;’ before ‘_fputwchar’
1261 | _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
| ^~~~~~~~~~
/usr/local/include/stdio.h:1262:18: error: expected ‘,’ or ‘;’ before ‘getwc’
1262 | wint_t __cdecl getwc(FILE *_File);
| ^~~~~
/usr/local/include/stdio.h:1263:18: error: expected ‘,’ or ‘;’ before ‘getwchar’
1263 | wint_t __cdecl getwchar(void);
| ^~~~~~~~
/usr/local/include/stdio.h:1264:18: error: expected ‘,’ or ‘;’ before ‘putwc’
1264 | wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
| ^~~~~
/usr/local/include/stdio.h:1265:18: error: expected ‘,’ or ‘;’ before ‘putwchar’
1265 | wint_t __cdecl putwchar(wchar_t _Ch);
| ^~~~~~~~
/usr/local/include/stdio.h:1266:18: error: expected ‘,’ or ‘;’ before ‘ungetwc’
1266 | wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
| ^~~~~~~
In file included from src/_portaudiomodule.c:27:
/usr/local/include/stdio.h:1516:28: error: expected ‘,’ or ‘;’ before ‘_wspawnl’
1516 | _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~
/usr/local/include/stdio.h:1517:28: error: expected ‘,’ or ‘;’ before ‘_wspawnle’
1517 | _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~~
/usr/local/include/stdio.h:1518:28: error: expected ‘,’ or ‘;’ before ‘_wspawnlp’
1518 | _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~~
/usr/local/include/stdio.h:1519:28: error: expected ‘,’ or ‘;’ before ‘_wspawnlpe’
1519 | _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~~~
/usr/local/include/stdio.h:1520:28: error: expected ‘,’ or ‘;’ before ‘_wspawnv’
1520 | _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
| ^~~~~~~~
/usr/local/include/stdio.h:1521:28: error: expected ‘,’ or ‘;’ before ‘_wspawnve’
1521 | _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
| ^~~~~~~~~
.
.
.
error: command '/usr/bin/gcc' failed with exit code 1
我已经通过 pacman 命令安装了 portaudio:pacman -S mingw-w64-x86_64-portaudio
我已将 ffmpeg exe 文件(可能)放入 /usr/bin。
我认为 gcc 版本有问题。
如何在 Windows 10 (msys2 mingw64) 中安装 python pyaudio 模块?
以前我在另一台电脑上成功安装过那个模块,但现在没有说明,所以可以。
我应该安装 Microsoft Visual C++ Redistridutable 吗?
有必要吗?
在msys2 mingw64环境下安装pyaudio模块的步骤。
- 下载pyaudio from github
- 下载portaudio
- 将 portaudio 放入 pyaudio 项目文件夹
- 运行
pacman -S mingw-w64-x86_64-portaudio
- 运行
PATH=/C/msys64/mingw64/bin
其中 C:\msys64\mingw64\bin 包含 gcc.exe 的文件夹。
如果你还没有安装 gcc 你可以 运行: pacman -S gcc
- 转到 pyaudio 项目和 运行
python setup.py build_ext --inplace
最后 运行:
python setup.py install
就是这样!
python 模块将成功安装到 msys 平台。
我不知道是否需要所有向上指令,但现在可以使用了!
我正在尝试在新机器上的 MSYS2/MingGW64 中安装 pyaudio python 模块。
Χρήστος Παππάς@DESKTOP-8T1C1VF MSYS /c/Users/Χρήστος Παππάς/Documents/projects/Papinhio player/Αρχεία πηγαίου κώδικα εφαρμογής (python)
$ cd ../Σημειώσεις\ και\ βιβλιοθήκες\ \(notes\)/
Χρήστος Παππάς@DESKTOP-8T1C1VF MSYS /c/Users/Χρήστος Παππάς/Documents/projects/Papinhio player/Σημειώσεις και βιβλιοθήκες (notes)
$ cd PyAudio-0.2.11/
Χρήστος Παππάς@DESKTOP-8T1C1VF MSYS /c/Users/Χρήστος Παππάς/Documents/projects/Papinhio player/Σημειώσεις και βιβλιοθήκες (notes)/PyAudio-0.2.11
$ python setup.py build
running build
running build_py
running build_ext
building '_portaudio' extension
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -I/usr/include/python3.9 -c src/_portaudiomodule.c -o build/temp.msys-3.2.0-x86_64-3.9/src/_portaudiomodule.o
In file included from src/_portaudiomodule.c:27:
/usr/local/include/stdio.h:1258:18: error: expected ‘,’ or ‘;’ before ‘fgetwc’
1258 | wint_t __cdecl fgetwc(FILE *_File);
| ^~~~~~
/usr/local/include/stdio.h:1259:26: error: expected ‘,’ or ‘;’ before ‘_fgetwchar’
1259 | _CRTIMP wint_t __cdecl _fgetwchar(void);
| ^~~~~~~~~~
/usr/local/include/stdio.h:1260:18: error: expected ‘,’ or ‘;’ before ‘fputwc’
1260 | wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
| ^~~~~~
/usr/local/include/stdio.h:1261:26: error: expected ‘,’ or ‘;’ before ‘_fputwchar’
1261 | _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
| ^~~~~~~~~~
/usr/local/include/stdio.h:1262:18: error: expected ‘,’ or ‘;’ before ‘getwc’
1262 | wint_t __cdecl getwc(FILE *_File);
| ^~~~~
/usr/local/include/stdio.h:1263:18: error: expected ‘,’ or ‘;’ before ‘getwchar’
1263 | wint_t __cdecl getwchar(void);
| ^~~~~~~~
/usr/local/include/stdio.h:1264:18: error: expected ‘,’ or ‘;’ before ‘putwc’
1264 | wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
| ^~~~~
/usr/local/include/stdio.h:1265:18: error: expected ‘,’ or ‘;’ before ‘putwchar’
1265 | wint_t __cdecl putwchar(wchar_t _Ch);
| ^~~~~~~~
/usr/local/include/stdio.h:1266:18: error: expected ‘,’ or ‘;’ before ‘ungetwc’
1266 | wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
| ^~~~~~~
In file included from src/_portaudiomodule.c:27:
/usr/local/include/stdio.h:1516:28: error: expected ‘,’ or ‘;’ before ‘_wspawnl’
1516 | _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~
/usr/local/include/stdio.h:1517:28: error: expected ‘,’ or ‘;’ before ‘_wspawnle’
1517 | _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~~
/usr/local/include/stdio.h:1518:28: error: expected ‘,’ or ‘;’ before ‘_wspawnlp’
1518 | _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~~
/usr/local/include/stdio.h:1519:28: error: expected ‘,’ or ‘;’ before ‘_wspawnlpe’
1519 | _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
| ^~~~~~~~~~
/usr/local/include/stdio.h:1520:28: error: expected ‘,’ or ‘;’ before ‘_wspawnv’
1520 | _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
| ^~~~~~~~
/usr/local/include/stdio.h:1521:28: error: expected ‘,’ or ‘;’ before ‘_wspawnve’
1521 | _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
| ^~~~~~~~~
.
.
.
error: command '/usr/bin/gcc' failed with exit code 1
我已经通过 pacman 命令安装了 portaudio:pacman -S mingw-w64-x86_64-portaudio
我已将 ffmpeg exe 文件(可能)放入 /usr/bin。 我认为 gcc 版本有问题。
如何在 Windows 10 (msys2 mingw64) 中安装 python pyaudio 模块?
以前我在另一台电脑上成功安装过那个模块,但现在没有说明,所以可以。 我应该安装 Microsoft Visual C++ Redistridutable 吗? 有必要吗?
在msys2 mingw64环境下安装pyaudio模块的步骤。
- 下载pyaudio from github
- 下载portaudio
- 将 portaudio 放入 pyaudio 项目文件夹
- 运行
pacman -S mingw-w64-x86_64-portaudio
- 运行
PATH=/C/msys64/mingw64/bin
其中 C:\msys64\mingw64\bin 包含 gcc.exe 的文件夹。 如果你还没有安装 gcc 你可以 运行:pacman -S gcc
- 转到 pyaudio 项目和 运行
python setup.py build_ext --inplace
最后 运行: python setup.py install
就是这样! python 模块将成功安装到 msys 平台。 我不知道是否需要所有向上指令,但现在可以使用了!