簡體   English   中英

GZIP python3 AttributeError:“模塊”對象沒有屬性“壓縮”

[英]GZIP python3 AttributeError: 'module' object has no attribute 'compress'

pipe.setnx(prefix+item[0], gzip.compress(bytes(item[1], 'utf-8')))

我正在嘗試在EC2實例上使用gzip python lib壓縮文件。 我認為gzip是標准庫的一部分。 但是,出現以下錯誤

AttributeError: 'module' object has no attribute 'compress'

我發現其他人添加了一個名為gzip的庫。 因此,它默認為該庫,而不是標准庫。 我最終改為使用zlib。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM