#python #mingw-w64 #pyaudio #portaudio #msys
Вопрос:
я пытаюсь установить pyaudio python модуль в MSYS2/MingGW64 на новой машине.
Χρήστος Παππάς@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
Я установил portaudio с помощью команды pacman: pacman -S mingw-w64-x86_64-portaudio
Я поместил exe-файлы ffmpeg (возможно) в /usr/bin. Я думаю, что что-то не так с версией gcc.
Как я могу установить модуль python pyaudio в Windows 10 (msys2 mingw64)?
В прошлом я успешно устанавливал этот модуль на другой компьютер, но сейчас у меня нет инструкций, так что это может быть. Должен ли я установить Microsoft Visual C с возможностью Повторного Переопределения? Это необходимо?
Ответ №1:
Шаг для установки модуля pyaudio в среде msys2 mingw64.
- Скачать pyaudio с github
- Скачать portaudio
- Поместите portaudio в папку проекта pyaudio
- Бежать
pacman -S mingw-w64-x86_64-portaudio
- Беги
PATH=/C/msys64/mingw64/bin
куда C:msys64mingw64bin папка, содержащая gcc.exe. Если вы не установили gcc, вы можете запустить:pacman -S gcc
- Перейдите в проект pyaudio и запустите
python setup.py build_ext --inplace
, и, наконец, запустите: python setup.py install
Вот и все! Модуль python будет успешно установлен на платформу msys. Я не знаю, нужны ли все инструкции, но теперь работает!