我最近也遇到了这个问题。简单地运行“import sounddevice”会使 Python 崩溃。将 sounddevice 降级到 0.3.8 为我解决了这个问题。
如果我附加一个调试器,崩溃报告
Unhandled exception at 0x00007FFDBD20CB98 (InProcessClient64.dll) in python.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.
> InProcessClient64.dll!00007ffdbd20cb98() Unknown
InProcessClient64.dll!00007ffdbd20cb2d() Unknown
InProcessClient64.dll!00007ffdbd20cb49() Unknown
InProcessClient64.dll!00007ffdbd2128b2() Unknown
InProcessClient64.dll!00007ffdbd1b705b() Unknown
InProcessClient64.dll!00007ffdbd17bf89() Unknown
InProcessClient64.dll!00007ffdbd1a6a29() Unknown
InProcessClient64.dll!00007ffdbd17bea8() Unknown
_cffi_backend.cp36-win_amd64.pyd!00007ffd8d860258() Unknown
_cffi_backend.cp36-win_amd64.pyd!PyInit__cffi_backend() + 6948 bytes Unknown
python36.dll!_PyCFunction_FastCallDict() + 386 bytes Unknown
python36.dll!PyObject_CallFunctionObjArgs() + 899 bytes Unknown
python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
python36.dll!_Py_CheckFunctionResult() + 779 bytes Unknown
python36.dll!PyOS_FSPath() + 565 bytes Unknown
python36.dll!PyOS_FSPath() + 279 bytes Unknown
python36.dll!_PyEval_EvalFrameDefault() + 13746 bytes Unknown
python36.dll!_Py_CheckFunctionResult() + 779 bytes Unknown
python36.dll!PyObject_CallFunctionObjArgs() + 2031 bytes Unknown
python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
python36.dll!PyObject_CallFunctionObjArgs() + 1374 bytes Unknown
python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
python36.dll!PyObject_CallFunctionObjArgs() + 1374 bytes Unknown
python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
python36.dll!PyObject_CallFunctionObjArgs() + 1374 bytes Unknown
python36.dll!_PyEval_EvalFrameDefault() + 969 bytes Unknown
python36.dll!_PyFunction_FastCallDict() + 218 bytes Unknown
python36.dll!_PyObject_FastCallDict() + 321 bytes Unknown
python36.dll!_PyObject_CallMethodIdObjArgs() + 176 bytes Unknown
python36.dll!PyImport_ImportModuleLevelObject() + 529 bytes Unknown
python36.dll!_PyEval_EvalFrameDefault() + 12700 bytes Unknown
python36.dll!_Py_CheckFunctionResult() + 779 bytes Unknown
python36.dll!PyEval_EvalCodeEx() + 155 bytes Unknown
python36.dll!PyEval_EvalCode() + 45 bytes Unknown
python36.dll!PyArena_Free() + 167 bytes Unknown
python36.dll!PyRun_InteractiveOneObject() + 715 bytes Unknown
python36.dll!PyRun_InteractiveLoopFlags() + 240 bytes Unknown
python36.dll!PyRun_AnyFileExFlags() + 69 bytes Unknown
python36.dll!00000000537caf44() Unknown
python36.dll!000000005374e57a() Unknown
python.exe!000000001c1a126d() Unknown
kernel32.dll!BaseThreadInitThunk() + 20 bytes Unknown
ntdll.dll!RtlUserThreadStart() + 33 bytes Unknown
我无法确定为什么会发生这种情况,但降级 sounddevice 已修复它。就我个人而言,sounddevice 0.3.8 是最后一个有效的
C:\>python -m pip install sounddevice==
ERROR: Could not find a version that satisfies the requirement sounddevice== (from versions: 0.1.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.3.9, 0.3.10, 0.3.11, 0.3.12, 0.3.13, 0.3.14, 0.3.15, 0.4.0)
ERROR: No matching distribution found for sounddevice==
C:\>python -m pip install sounddevice==0.4.0
Collecting sounddevice==0.4.0
Installing collected packages: sounddevice
Successfully installed sounddevice-0.4.0
C:\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sounddevice
C:\>python -m pip install sounddevice==0.3.9
Collecting sounddevice==0.3.9
Installing collected packages: sounddevice
Attempting uninstall: sounddevice
Found existing installation: sounddevice 0.4.0
Uninstalling sounddevice-0.4.0:
Successfully uninstalled sounddevice-0.4.0
Successfully installed sounddevice-0.3.9
C:\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sounddevice
C:\>python -m pip install sounddevice==0.3.8
Collecting sounddevice==0.3.8
Installing collected packages: sounddevice
Attempting uninstall: sounddevice
Found existing installation: sounddevice 0.3.9
Uninstalling sounddevice-0.3.9:
Successfully uninstalled sounddevice-0.3.9
Successfully installed sounddevice-0.3.8
C:\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sounddevice
>>> exit()
C:\>