extract xz file in python

919 Views Asked by At

I have a file data.csv.xz. I want to extract the csv file but not manually. I find a way by using the package lzma. But when I pip install lama in python 3.8 in spyder, I got an error:

ERROR: Could not find a version that satisfies the requirement lzma (from versions: none) ERROR: No matching distribution found for lzma

what's wrong with the version 3.8 ? And, is there any other way to accomplish this task?

3

There are 3 best solutions below

0
Amit Singh On BEST ANSWER

lzma is part of the standard library of Python, so you won't find it in the PyPi indices.

To verify, simply fire up your python shell and just try :

>>> import lzma
>>>

It should work.

0
Vishal Asrani On

lzma is a part of standard library of Python. You dont need to install it, instead you can directly import it.

You can refer this https://docs.python.org/3/library/lzma.html#module-lzma

0
new Q Open Wid On

As said, you won't need to install lzma, as it is already in the pip standard library.

There's absolutely nothing wrong with your Python (hopefully).