gpt4 book ai didi

python - 在 Google Colab 上解压缩 .7z 文件

转载 作者:行者123 更新时间:2023-12-04 09:35:10 28 4
gpt4 key购买 nike

我的谷歌驱动器中有一个名为“mathoverflow.net.7z”的 Zip 文件,我已使用给定的代码将其加载到 colab。但是,当我尝试解压缩它时,出现错误。请提出一种纠正方法。
这是我的代码:

!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials

auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)

downloaded = drive.CreateFile({'id':'15h0f8p9n6OG1B796q-gbP5oXstCuOcDM'})
downloaded.GetContentFile('mathoverflow.net.7z')
直到这个它工作正常。但是当我运行它时,我收到以下错误。
!unzip mathoverflow.net.7z

Archive: mathoverflow.net.7z End-of-central-directory signature notfound. Either this file is not a zipfile, or it constitutes onedisk of a multi-part archive. In the latter case the centraldirectory and zipfile comment will be found on the last disk(s) ofthis archive. unzip: cannot find zipfile directory in one ofmathoverflow.net.7z ormathoverflow.net.7z.zip, and cannot find mathoverflow.net.7z.ZIP, period.

最佳答案

您可以使用 7z反而。它已经预装在 Colab 中

!7z e mathoverflow.net.7z

关于python - 在 Google Colab 上解压缩 .7z 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62625117/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com