Closed the-bobo closed 8 years ago
pip
: pip install zstd
. Or pip3
for python-3.2+.import zstd
cmp_data = zstd.compress(data, level)
level
is an integer from 1
to 20
.
Sorry I am new to python. For pip install, when do I do that (after python setup.py build clean?) and in what directory?
And thanks, I am using Python 2.7.5. On Jun 27, 2016 6:49 PM, "Sergey" notifications@github.com wrote:
- You can try to use pip: pip install zstd. Or pip3 for python-3.2+.
- Yes, it has zlib-like interface:
import zstd
cmp_data = zstd.compress(data, level)
level is an integer from 1 to 20.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/python-zstd/issues/6#issuecomment-228926620, or mute the thread https://github.com/notifications/unsubscribe/AEIej9M3GLea5kPC3eXdY5M_HPQXrZVRks5qQH2RgaJpZM4I_kik .
You do that any time in any directory. Better by root user.
pip
is a package manager for Python - https://pip.pypa.io/en/stable/.
It uses python packages repository - https://pypi.python.org/pypi
In Ubuntu/Debian distro install it with apt-get install python-pip python3-pip
And if you need to import module from custom dir, prepend path to sys.path:
sys.path.insert(0, <path_to_a_custom_directory>)
Ok cool, if I want to install zstd in a specific directory can I do that with pip install? Should I just use venv instead? Not sure what best practice is here.
Thanks so much Sergey. Once I get it working I may submit a pull request with easier setup instructions for n00bs to your README.md if that's okay. On Jun 27, 2016 10:45 PM, "Sergey" notifications@github.com wrote:
And if you need to import module from custom dir, prepend path to sys.path:
sys.path.insert(0,
) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/python-zstd/issues/6#issuecomment-228954084, or mute the thread https://github.com/notifications/unsubscribe/AEIej5yBIVBQo741i4yU2InzGdE5H7Zsks5qQLTigaJpZM4I_kik .
I fixed this by changing:
sys.path.append(<path_to_a_custom_directory>)
import zstd
to
sys.path.append(<path_to_a_custom_directory>/zstd-0.6.1-py2.7-linux-x86_64.egg>)
import zstd
zstd.compress(data, level)
now works
Hi Sergey,
Thanks for putting this together. I think I've figured out how to install it, but am unsure how to invoke it from a script.
I try
import zstd
but I get aImportError: No module named zstd
For install, this is what I did (I do not have permission to install to the system directories):
This results in
ls <path_to_a_custom_directory>
returningeasy-install.pth site.py site.pyc zstd-0.6.1-py2.7-linux-x86_64.egg
Then in my code I have:
Where
level
is an integer from0
through9
referring to thezlib compression level
.