解决 FileNotFoundError: [WinError 2] 系统找不到指定的文件

编程过程中我遇到这种问题:

Traceback (most recent call last):
  File "C:\Users\asus\Desktop\High and Low Pass Filtering.py", line 26, in 
    wav = AudioSegment.from_wav("1.wav")
  File "D:\soft2\python\Pythonfiles\lib\site-packages\pydub\audio_segment.py", line 728, in from_wav
    return cls.from_file(file, 'wav', parameters=parameters)
  File "D:\soft2\python\Pythonfiles\lib\site-packages\pydub\audio_segment.py", line 665, in from_file
    info = mediainfo_json(orig_file)
  File "D:\soft2\python\Pythonfiles\lib\site-packages\pydub\utils.py", line 263, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
  File "D:\soft2\python\Pythonfiles\lib\subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "D:\soft2\python\Pythonfiles\lib\subprocess.py", line 1155, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

解决方法:

根据提示找到lib中的subprocess.py文件(比如小编的就是 D:\soft2\python\Pythonfiles\lib\subprocess.py) ,查找class Popen模块,再将这个模块中的
__init__函数中的shell = False 改成shell = True

解决 FileNotFoundError: [WinError 2] 系统找不到指定的文件_第1张图片

你可能感兴趣的:(problem)