python3 mmh3安装及使用方法
2019-10-09 13:58
6985 查看
mmh3安装方法
哈希方法主要有MD、SHA、Murmur、CityHash、MAC等几种方法。mmh3全程murmurhash3,是一种非加密的哈希算法,常用于hadoop等分布式存储情境中,在anaconda中安装使用命令
pip install mmh3
问题1
报错如下:
Microsoft Visual C++ 14.0 is required
显示缺少C++ 14的库文件,选择登录网站 https://visualstudio.microsoft.com/downloads/
下载Visual Studio2015,自动安装后运行
pip install mmh3
问题2
报错如下:
error: command 'cl.exe' failed: No such file or directory
在Visual Studio Installer中(工具栏-获取工具与功能),选择添加红框标注功能
其他说明
建议安装的版本的Visual Studio2015,因为2015对应的是C++ 14的版本,如果是python2的mmh3需要对应C++ 9的版本,这主要是因为python2是基于C++ 9编译的,python3是基于C++ 14编译的,亲测安装VS2019并没有解决C++ 14缺失的问题。
mmh3使用
样例:
>>> import mmh3 >>> mmh3.hash('foo') # 32 bit signed int -156908512 >>> mmh3.hash('foo', 42) # uses 42 for its seed -1322301282 >>> mmh3.hash('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~'
总结
以上所述是小编给大家介绍的python3 mmh3安装及使用方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
相关文章推荐
- 使用setup.py安装python包和卸载python包的方法
- pip的安装,更新,卸载模块以及使用方法 python
- python django框架中使用FastDFS分布式文件系统的安装方法
- Python使用easy-install安装时报UnicodeDecodeError的解决方法
- Centos 7 安装 Python3.6后yum无法使用的解决方法
- Centos7下安装使用Pyinstaller及Python library not found错误解决方法
- Python3.x安装第三方库的方法 欢迎使用CSDN-markdown编辑器
- python 使用pip install 手动安装本地包的方法
- python之selenium安装及使用方法简介
- Py之dlib:Python库之dlib库的简介、安装、使用方法详细攻略——Jason niu
- Windows下安装Redis及使用Python操作Redis的方法
- python2.7无法使用pip的解决方法(安装easy_install)
- Python模块安装: pip常见的使用方法
- python安装与使用redis的方法
- Python、PyCharm安装及使用方法(Mac版)详解
- pip和easy_install的使用对比,python库文件安装方法
- 图核graph kernel方法Python工具包graphkernels的安装和使用
- Python使用pip安装报错:is not a supported wheel on this platform的解决方法
- Py之Pyinstaller:Python库之Pyinstaller简介、使用方法、安装详细攻略——Jason niu
- Python爬虫之pandas基本安装与使用方法示例