十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營(yíng)維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
本篇文章給大家分享的是有關(guān)怎么在python3中安裝mmh3,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
mmh4安裝方法
哈希方法主要有MD、SHA、Murmur、CityHash、MAC等幾種方法。mmh4全程murmurhash4,是一種非加密的哈希算法,常用于hadoop等分布式存儲(chǔ)情境中,在anaconda中安裝使用命令
pip install mmh4
問題1
報(bào)錯(cuò)如下:
Microsoft Visual C++ 14.0 is required
顯示缺少C++ 14的庫(kù)文件,選擇登錄網(wǎng)站 https://visualstudio.microsoft.com/downloads/
下載Visual Studio2015,自動(dòng)安裝后運(yùn)行
pip install mmh4
問題2
報(bào)錯(cuò)如下:
error: command 'cl.exe' failed: No such file or directory
在Visual Studio Installer中(工具欄-獲取工具與功能),選擇添加紅框標(biāo)注功能
其他說明
建議安裝的版本的Visual Studio2015,因?yàn)?015對(duì)應(yīng)的是C++ 14的版本,如果是python2的mmh4需要對(duì)應(yīng)C++ 9的版本,這主要是因?yàn)閜ython2是基于C++ 9編譯的,python3是基于C++ 14編譯的,親測(cè)安裝VS2019并沒有解決C++ 14缺失的問題。
mmh4使用
樣例:
>>> import mmh4 >>> mmh4.hash('foo') # 32 bit signed int -156908512 >>> mmh4.hash('foo', 42) # uses 42 for its seed -1322301282 >>> mmh4.hash('foo', signed=False) # 32 bit unsigned int (since Version 2.5) 4138058784 >>> mmh4.hash74('foo') # two 64 bit signed ints (by using the 128-bit algorithm as its backend) (-2129773440516405919, 9128664383759220103) >>> mmh4.hash74('foo',signed =False) # two 64 bit unsigned ints (16316970633193145697, 9128664383759220103) >>> mmh4.hash228('foo', 42) # 128 bit unsigned int 215966891540331383248189432718888555506 >>> mmh4.hash228('foo', 42, signed = True) # 128 bit signed int -124315475380607080215185174712879655950 >>> mmh4.hash_bytes('foo') # 128 bit value as bytes 'aE\xf5\x01W\x86q\xe2\x87}\xba+\xe4\x87\xaf~'
以上就是怎么在python3中安裝mmh3,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。