簡體   English   中英

將python2庫pybloomfilter更改為python3

[英]Change python2 library pybloomfilter to python3

我想使用pybloomfilter軟件包: https : //github.com/axiak/pybloomfiltermmap ,我設法將其安裝在python3下,但似乎保存的文件沒有原始信息(在python2下,這不會發生),我研究了源代碼,似乎沒有特定於python2的東西,因此我完全迷失了如何使該庫與python3兼容。

EDIT1:通過“沒有原始信息”,我的意思是,當我向過濾器中添加一些字符串,然后結束程序,下一次,我將使用open來加載過濾器,過濾器很清晰,它不記得了添加的字符串。

pybloomfiltermmap3是Michael Axiak(@axiak)編寫的pybloomfiltermmap的Python 3分支。

class pybloomfilter.BloomFilter(capacity : int, error_rate : float[,
                                filename=None : string ][, perm=0755 ])

安裝:

請安裝Cython。 請注意,此版本適用於Python3。如果您使用的是Python 2,請參閱https://github.com/axiak/pybloomfiltermmap

安裝:

$ pip install cython 
$ pip install pybloomfiltermmap3

來構建和安裝模塊。

還有一個實例方法來同步文件:

BloomFilter.sync()
  Forces a sync() call on the underlying mmap file object.
  Use this if you are about to copy the file and you want to be Sure (TM)
  you got everything correctly.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM