如何使用Google Colab解压.gz文件?

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

我下载了扩展名为 .gz 的英文 FastText 嵌入文件。当我打算使用 Google Colab 解压它时,出现以下错误:

Archive:  /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz 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/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz or /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz.zip, and cannot find /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz.ZIP, period
\n!unzip  '/content/drive/My Drive/New_ABCDM_Architec/cc.fr.300.vec.gz'\n!unzip  '/content/drive/My Drive/New_ABCDM_Architec/cc.ar.300.vec.gz'\n

我知道要使用

!unzip
,文件应该有 .zip 扩展名。我的问题是,如何解压 .gz 文件?

python google-colaboratory unzip
1个回答
0
投票
!tar -xzvf "/content/drive/path/file_name.tar.gz" "/content/drive/path/destination_directory"

 

旗帜

  • -x:提取
  • -c:创建一个新的存档
  • -v:详细输出
  • -f:使用给定的存档文件(名称.扩展名)
  • -z :通过 gzip 过滤存档
  • -j :通过 bzip2 过滤存档
© www.soinside.com 2019 - 2024. All rights reserved.