SoFunction
Updated on 2024-10-30

Installation of the mmh3 library for python and its use.

mmh3 installation method

The main hash methods are MD, SHA, Murmur, CityHash, MAC and several others.

mmh3 throughout murmurhash3, is a non-cryptographic hash algorithm, commonly used in hadoop and other distributed storage contexts, in anaconda to install and use the command

pip install mmh3

Question 1

在这里插入图片描述

The error is as follows.

Microsoft Visual C++ 14.0 is required

Showing missing library files for C++ 14, select login site/downloads/ Download Visual Studio 2015, install it automatically and run it.

pip install mmh3

Question 2

在这里插入图片描述

The error is as follows.

error: command '' failed: No such file or directory

In the Visual Studio Installer (Toolbar - Get Tools & Features), select the Add Red Box annotation feature

在这里插入图片描述

在这里插入图片描述

Other notes

It is recommended to install the version of Visual Studio 2015, because 2015 corresponds to the version of C++ 14, if it is python2 mmh3 need to correspond to the version of C++ 9, this is mainly because python2 is based on the compilation of C++ 9

python3 is compiled based on C++ 14, and pro-testing installing VS2019 didn't solve the problem of missing C++ 14.

mmh3 use

在这里插入图片描述

Sample:

>>> import mmh3
>>> ('foo') 
# 32 bit signed int
-156908512
>>> ('foo', 42) 
# uses 42 for its seed
-1322301282
>>> ('foo', signed=False) 
# 32 bit unsigned int (since Version 2.5)
4138058784
>>> mmh3.hash64('foo') 
# two 64 bit signed ints (by using the 128-bit algorithm as its backend)
(-2129773440516405919, 9128664383759220103)
>>> mmh3.hash64('foo',signed =False)                    
 #  two 64 bit unsigned ints
(16316970633193145697, 9128664383759220103)
>>> mmh3.hash128('foo', 42)                                    
# 128 bit unsigned int
215966891540331383248189432718888555506
>>> mmh3.hash128('foo', 42, signed = True)            
# 128 bit signed int
-124315475380607080215185174712879655950
>>> mmh3.hash_bytes('foo')                                     
# 128 bit value as bytes
'aE\xf5\x01W\x86q\xe2\x87}\xba+\xe4\x87\xaf~'

to this article on the installation of python's mmh3 library as well as the use of the article is introduced to this, more related to the content of python's mmh3 library, please search for my previous articles or continue to browse the following related articles I hope that you will support me more in the future!