无法使用 pip 安装 playsound

无法使用 pip 安装 playsound

我无法使用 pip 安装 playsound。

PS E:\python> 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
  ╰─> [29 lines of output]
      Traceback (most recent call last):
        File "C:\Users\Dell\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\Dell\AppData\Local\Programs\Python\Python311\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 "C:\Users\Dell\AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 1244, in getsourcelines
          lines, lnum = findsource(object)
                        ^^^^^^^^^^^^^^^^^^
        File "C:\Users\Dell\AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 1081, in findsource          raise OSError('could not get source code')
      OSError: could not get source code
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
PS E:\python>

答案1

尝试安装/升级轮子:

pip install --upgrade wheel

这对我有用。

答案2

我遇到了同样的问题。尝试退出然后重新进入,然后执行 pip install wheel,然后 pip install playsound

有时,如果你已经安装了 wheel,则 pip uninstall heel 然后再次安装,然后安装 playsound

相关内容