我在 CentOS 6 上有一个新编译的 python 3.2.3,我无法让 tarfile 模块与 gzip 文件一起工作。
Python 3.2.3 (default, Sep 17 2012, 16:49:57)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tarfile
>>> t = tarfile.open("test.tar.gz")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/python3/lib/python3.2/tarfile.py", line 1746, in open
raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully
tar 文件使用普通的 tar 实用程序正常解压。我缺少一些依赖项吗?