@ Shared server / environment without pyenv or anaconda
Of course, the Python version should be 2 series.
$ pip install --install-option="--prefix=$HOME/share" backports.lzma
# -*- encoding: utf-8 -*-
try:
import lzma
except:
import sys
sys.path.append('/home/bunzaemon/share/lib64/python2.6/site-packages')
from backports import lzma
with lzma.open("dat.txt.xz") as f:
print (f.read().decode())
--The contents are ascii only.
--In 2 series, decode ()
is not necessary. But it works even if there is.
--Since it is binary in 3 series, decode ()
is required.
Recommended Posts