Python 从shutil.make_归档转到zipfile.zipfile以支持Zip64

Python 从shutil.make_归档转到zipfile.zipfile以支持Zip64,python,zip,zipfile,shutil,Python,Zip,Zipfile,Shutil,我的代码中有以下行: shutil.make_archive(os.path.splitext(output_file)[0], 'zip', output_dir) 这将产生以下错误: LargeZipFile: Central directory offset would require ZIP64 extensions Traceback (most recent call last): File "<MY FILE>", line 782, in

我的代码中有以下行:

shutil.make_archive(os.path.splitext(output_file)[0], 'zip', output_dir)
这将产生以下错误:

LargeZipFile: Central directory offset would require ZIP64 extensions
Traceback (most recent call last):
  File "<MY FILE>", line 782, in run
    with ZipFile(os.path.splitext(output_file)[0], mode='w', allowZip64=True) as z:
  File "/usr/lib/python2.7/zipfile.py", line 756, in __init__
    self.fp = open(file, modeDict[mode])
IOError: [Errno 21] Is a directory: '<MY LOCATION>'
我在不同的地方(例如)读到,在Python2.7中不可能使用
shutil.make_archive
Zip64
格式。因此,我需要直接调用
zipfile.zipfile

我的问题是:如何更改代码以使用此函数?通过阅读文档是不清楚的。我尝试了以下方法:

with ZipFile(os.path.splitext(output_file)[0], mode='w', allowZip64=True) as z:
    z.write(output_dir)
并得到以下错误:

LargeZipFile: Central directory offset would require ZIP64 extensions
Traceback (most recent call last):
  File "<MY FILE>", line 782, in run
    with ZipFile(os.path.splitext(output_file)[0], mode='w', allowZip64=True) as z:
  File "/usr/lib/python2.7/zipfile.py", line 756, in __init__
    self.fp = open(file, modeDict[mode])
IOError: [Errno 21] Is a directory: '<MY LOCATION>'
回溯(最近一次呼叫最后一次):
文件“”,第782行,正在运行
ZipFile(os.path.splitext(output_file)[0],mode='w',allowZip64=True)为z:
文件“/usr/lib/python2.7/zipfile.py”,第756行,在__
self.fp=open(文件,modeDict[mode])
IOError:[Errno 21]是一个目录:“”
多谢各位