“libarchive“ is multi-format archive and compression library written in C. It supports a lof of compression formats and archive formats. The full list can be found here.
There is another “libarchive“ pip package written in Python which is a Python wrapper of the C version “libarchive”. You can use this pip package if you want to use Python to manipulate different compression/archive formats.
To install the “libarchive“ Python pip package, you need to install the native C “libarchive” library first if you didn’t have it.
sudo apt-get install libarchive-dev
brew install libarchive
Now for Linux, you can run pip to install the Python “libarchive” pip package:
pip install libarchive
For Mac, you need one more step to set the “libarchive.dylib” path first, otherwise the installation will fail.
# From: https://github.com/dsoprea/PyEasyArchive/issues/16
Now you should be able to use the Python “libarchive” pip package now. For example:
More code samples can be found here.