如何使用shutil.make_archive创建zip64存档 [英] How to create zip64 archive using shutil.make_archive

查看:41
本文介绍了如何使用shutil.make_archive创建zip64存档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从文件夹创建 zip 存档文件的 Python 代码片段.

Python code snippet which creates creates zip archive file from a folder.

shutil.make_archive(file_path, 'zip', folder_path)

我收到此错误:

文件大小需要 ZIP64 扩展名.

Filesize would require ZIP64 extensions.

如何使用 shutil.make_archive 创建 ZIP64 存档文件?

How to create ZIP64 archive file using shutil.make_archive?

注意:我不能使用 zipfile.ZipFile 函数.

Note: I cannot use zipfile.ZipFile function.

推荐答案

您必须使用 3.4 之前的 Python 版本不幸的是,在 github github 上阅读了 Shutil 源代码后.很明显,它使用 zipfile 中的 zipfile.ZipFile 这是一个封闭的问题,现在见这里 python,所以从 Python 开始3.4、ZIP64 扩展默认可用.但是在 Python 3.4 之前,make_archive 不会创建带有 ZIP64 扩展名的文件.如果您使用的是旧版本的 Python 并且想要 ZIP64,您可以直接使用您已经提到的 zipfile.ZipFile() .

You must be using a Python version prior to 3.4 unfortunately after reading shutil source code on github github . it's clearly using zipfile.ZipFile from zipfile this is a closed issue now see here python, so Starting from Python 3.4, ZIP64 extensions is availble by default . But Prior to Python 3.4, make_archive will not create a file with ZIP64 extensions. If you are using an older version of Python and want ZIP64, you can use the zipfile.ZipFile() directly which you already mentioned .

这篇关于如何使用shutil.make_archive创建zip64存档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆