【发布时间】:2018-08-03 18:22:04
【问题描述】:
我有一个程序需要解压缩 .xz 压缩存档 How to decompress a .xz file which has multiple folders/files inside, in a single go?。
我已经读到这可以通过pip install pyliblzma 使用 lzma 来实现,但是在通过 pip 安装时,这似乎在 Windows 上被破坏了。
Collecting pyliblzma
Using cached https://files.pythonhosted.org/packages/17/48/5292ade507dafe573360560ba53783395587dc42eb32b347feb2ac70fc6b/pyliblzma-0.5.3.tar.bz2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\ben\appdata\local\temp\pip-install-_hmrno\pyliblzma\setup.py", line 48, in <module>
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True).stdout.read():
File "c:\python27\lib\subprocess.py", line 347, in __init__
raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr
我也尝试过pip install pylzma,但这需要适用于 Python 的 Visual Studio C++ 编译器
building 'pylzma' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
由于我的程序是可移植的并在用户之间共享,我想尽量避免让他们安装单独的二进制文件以与程序一起使用。
是否有另一种方法可以在 Python2.7 中不使用 lzma 来精确压缩 .xz 档案,或者通过pip install 获得 lzma 的工作版本?
【问题讨论】:
标签: python python-2.7 lzma