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

Python:FileNotFoundError:[WinError 2]系统找不到指定的文件,python,machine-learning,path,filepath,Python,Machine Learning,Path,Filepath,我对python有一点经验,我目前正尝试通过这个工具通过pix2pix生成一些机器学习视频 我目前正处于需要从视频中提取帧的位置。我使用的是同一个视频,但为了方便起见,我将它移到了与extract_frames.py相同的目录中 我一直收到WinError 2:系统找不到指定的文件: C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD>python extract_frames.py -video fire.mp4 -name fire_dataset

我对python有一点经验,我目前正尝试通过这个工具通过pix2pix生成一些机器学习视频

我目前正处于需要从视频中提取帧的位置。我使用的是同一个视频,但为了方便起见,我将它移到了与extract_frames.py相同的目录中

我一直收到WinError 2:系统找不到指定的文件:

C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD>python extract_frames.py -video fire.mp4 -name fire_dataset -p2pdir . -width 1280 -height 736
creating the dataset structure
ffmpeg -v 16 -i C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\fire.mp4 -q:v 2 -vf "scale=iw*736/ih:736, crop=1280:736" C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD/datasets/fire_dataset/train_frames/frame-%06d.jpg -hide_banner
extracting the frames
Traceback (most recent call last):
  File "C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\extract_frames.py", line 32, in <module>
    video_utils.extract_frames_from_video(
  File "C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\video_utils.py", line 82, in extract_frames_from_video
    p = subprocess.Popen(shlex.split(command), shell=False)
  File "C:\Users\cadou\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\cadou\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD>python extract\u frames.py-video fire.mp4-name fire\u dataset-p2pdir-宽度1280-高度736
创建数据集结构
ffmpeg-v16-ic:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\fire.mp4-q:v2-vf“scale=iw*736/ih:736,crop=1280:736”C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD/datasets/fire\dataset/train\frames/frame-%06d.jpg-隐藏横幅
提取帧
回溯(最近一次呼叫最后一次):
文件“C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\extract_frames.py”,第32行,在
视频\u utils.从\u视频中提取\u帧\u(
文件“C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\video\u utils.py”,第82行,从视频中提取帧
p=subprocess.Popen(shlex.split(命令),shell=False)
文件“C:\Users\cadou\AppData\Local\Programs\Python\Python39\lib\subprocess.py”,第951行,在\uuu init中__
self.\u execute\u child(参数、可执行文件、预执行文件、关闭文件、,
文件“C:\Users\cadou\AppData\Local\Programs\Python\Python39\lib\subprocess.py”,第1420行,在执行子进程中
hp、ht、pid、tid=\u winapi.CreateProcess(可执行文件、参数、,
FileNotFoundError:[WinError 2]系统找不到指定的文件

我查找了此错误并尝试了一些方法,但似乎没有一种方法可以解决我的问题。我怀疑这与路径有关,但我也尝试过改变它。我还安装了教程中要求的所有库(dominate、ffmpeg和pyTorch)。

您可以尝试以下命令,将“fire.mp4”替换为“/火警.mp4”


Erorr不显示找不到的文件

也许它找不到
fire.mp4
,但我想它需要
ffmpeg
来提取视频



我在
video_utils.py
中检查了
子流程的源代码,然后它就运行了-所以您需要从安装它

它可能还需要更改
video_utils.py
并使用
C:\full\path\to\ffmpeg.exe


还有到
Ubuntu
font的硬编码路径(在两个地方:参见)这表明此代码是为
Linux Ubuntu
创建的。此路径还需要更改Windows上的其他字体。

这是完全错误吗?它没有显示找不到的文件。可能它找不到
fire.mp4
,但可能需要
ffmpeg
来提取视频。我在中检查了
子进程的源代码e> video_-utils.py
运行-需要从中安装。它可能还需要更改
video_-utils.py
并使用
C:\full\path\to\ffmpeg.exe
。还有
Ubuntu字体
的硬编码路径,这表明此代码是为Linux Ubuntu创建的。感谢您的响应。我从网站安装了ffmpeg我以前让pip安装过它,但我想这还不够。我不再收到同样的错误,但现在它返回以下信息:
创建数据集结构ffmpeg-v16-ic:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\fire.mp4-q:v2-vf“scale=iw*736/ih:736,crop=1280:736“C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD/datasets/fire_dataset/train_frames/frame-%06d.jpg-hide_横幅提取帧C:userscadoOnedrivedesktopmlpix2pixhdfire.mp4:在Python中,没有这样的文件或目录
char\在文本中有特殊意义(但在其他语言中也有特殊意义)-即,
\n
用于新行,
\t
用于制表符-您可能必须在路径中使用double\\in-like
“C:\\Users\\…”
或您应该在
原始文本中使用前缀
r
-like
r“C:\Users\…”
双反斜杠返回:
创建数据集结构ffmpeg-v16-ic:\Users\cadou\Downloads\fire.mp4-q:v2-vf“scale=iw*736/ih:736,crop=1280:736”C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD/datasets/fire\u dataset/train\frames/frame-%06d.jpg-hide\u横幅提取帧C:UserscadouDownloadsfire.mp4:没有这样的文件或目录
原始文本返回:
回溯(最近一次调用):文件“C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\extract\extract\u frames.py”,第18行,在提升异常(“视频不存在”)异常中:视频不存在
python extract_frames.py -video ./fire.mp4 -name fire_dataset -p2pdir . -width 1280 -height 736