pip install playsound后发现一直报错,报错如下:

Collecting playsound
Using cached playsound-1.3.0.tar.gz (7.7 kB)
Installing build dependencies … done
Getting requirements to build wheel … error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
Traceback (most recent call last):
File “D:\Desktop\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py”, line 353, in
main()
File “D:\Desktop\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py”, line 335, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File “D:\Desktop\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py”, line 118, in get_requires_for_build_wheel
return hook(config_settings)
File “C:\Users\86152\AppData\Local\Temp\pip-build-env-6164zitn\overlay\Lib\site-packages\setuptools\build_meta.py”, line 355, in get_requires_for_build_whee
l
return self._get_build_requires(config_settings, requirements=[‘wheel’])
File “C:\Users\86152\AppData\Local\Temp\pip-build-env-6164zitn\overlay\Lib\site-packages\setuptools\build_meta.py”, line 325, in _get_build_requires
self.run_setup()
File “C:\Users\86152\AppData\Local\Temp\pip-build-env-6164zitn\overlay\Lib\site-packages\setuptools\build_meta.py”, line 507, in run_setup
super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
File “C:\Users\86152\AppData\Local\Temp\pip-build-env-6164zitn\overlay\Lib\site-packages\setuptools\build_meta.py”, line 341, in run_setup
exec(code, locals())
File “”, line 6, in
File “D:\Desktop\lib\inspect.py”, line 985, in getsource
lines, lnum = getsourcelines(object)
File “D:\Desktop\lib\inspect.py”, line 967, in getsourcelines
lines, lnum = findsource(object)
File “D:\Desktop\lib\inspect.py”, line 798, in findsource
raise OSError(‘could not get source code’)
OSError: could not get source code
[end of output]

error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
PS D:\Desktop\Desktop\py_code> python — version
D:\Desktop\python.exe: can’t open file ‘version’: [Errno 2] No such file or directory

发现是在 build wheel 时报错,

输入

pip install --upgrade wheel

发现再安装就成功了。