解压错误:未找到中央目录结尾签名

问题描述 投票:0回答:2

!unzip '/content/Flowers-Dataset (1).zip'

我尝试在 google colab 中使用 python 命令 !unzip 解压缩。我尝试重新下载 zip 文件并上传,但错误仍然如下所示,

Archive:  /content/Flowers-Dataset (1).zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /content/Flowers-Dataset (1).zip or
        /content/Flowers-Dataset (1).zip.zip, and cannot find /content/Flowers-Dataset (1).zip.ZIP, period.
python google-colaboratory unzip
2个回答
3
投票

/content/Flowers-Dataset (1).zip
可以公开使用吗?如果是的话,你能发布一个链接吗?这将使故障查找问题变得更加容易。

另外,你是怎么下载的?

消息

End-of-central-directory signature not found
表示以下其中一项:

该文件根本不是 zip 文件。

如果您可以访问 Linux/Mac(或可以访问 Windows 上的 WSL),请运行

file /content/Flowers-Dataset (1).zip'
。如果它是一个 zip 文件,你应该得到这样的东西

$ file test.zip 
test.zip: Zip archive data, at least v1.0 to extract, compression method=store

如果

file
命令没有说它是 zip 文件,您可以发布输出吗?

该文件是 zip 文件,但内容已损坏或被截断。

尝试跑步

unzip -FF '/content/Flowers-Dataset (1).zip'
。这将尝试提取可恢复的文件。如果这确实恢复了文件,那么问题就是为什么 zip 文件已损坏。要了解我们需要访问 zip 文件或了解有关如何下载它的更多信息。


0
投票

运行命令之前请确保您的文件已成功上传。

您可以使用此命令在colab上解压文件:

解压数据集位置 -d 数据集提取位置

© www.soinside.com 2019 - 2024. All rights reserved.