局部敏感哈希(lsh)包安装成功

我们需要安装一个lsh包
直接

pip install lsh

报错

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://l
andinghub.visualstudio.com/visual-cpp-build-tools

我们需要安装一下这个东西

链接:https://pan.baidu.com/s/1wdYv76wxhOTffma2CQCWVw 
提取码:m7ho 
复制这段内容后打开百度网盘手机App,操作更方便哦

然后我们

pip install lsh
pip install lshash3

继续测试下面代码

from lshash.lshash import LSHash
lsh = LSHash(6, 8)
lsh.index([1,2,3,4,5,6,7,8])
lsh.index([2,3,4,5,6,7,8,9])
lsh.index([10,12,99,1,5,31,2,3])
a = lsh.query([1,2,3,4,5,6,7,7])
print(a)

有可能出现错误 future module is not …
future的作用:把下一个新版本的特性导入到当前版本,于是我们就可以在当前版本中测试一些新版本的特性。说的通俗一点,就是你不用更新python的版本,直接加这个模块,就可以使用python新版本的功能。

pip install future

此时问题解决
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_46815330/article/details/114522362