I've installed simhash using below command
pip install git+https://github.com/seomoz/simhash-py.git
and to check if it has been installed successfully below is the o/p of pip freeze
pip freeze | grep simhash
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
simhash-py==0.4.0
While running the below test case, i.e.,
import unittest
import simhash
class TestNumDifferingBits(unittest.TestCase):
'''Tests about num_differing_bits'''
def test_basic(self):
a = 0xDEADBEEF
b = 0xDEADBEAD
self.assertEqual(2, simhash.num_differing_bits(a, b))
if __name__ == '__main__':
unittest.main()
which I copied from here, I got below errors
ImportError: Failed to import test module: simhashGitHubTest
Traceback (most recent call last):
File "/usr/lib/python2.7/unittest/loader.py", line 254, in _find_tests
module = self._get_module_from_name(name)
File "/usr/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
__import__(name)
File "/home/pallav/PycharmProjects/pfda/src/simhashTest/simhashGitHubTest.py", line 4, in <module>
import simhash
ImportError: No module named simhash
Then, I replaced the name of the package to simhash-py(as pip) due to which I got below errors:
import simhash-py as simhash
^
SyntaxError: invalid syntax
Kindly help me out in running the test cases.
pip -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
Command for running test case(copied from PyCharm)
python -m unittest discover -s /home/pallav/PycharmProjects/pfda/src/simhashTest -p simhashGitHubTest.py -t /home/pallav/PycharmProjects/pfda/src/simhashTest in /home/pallav/PycharmProjects/pfda/src/simhashTest
I've installed it via an another method.
git clone https://github.com/seomoz/simhash-py.git
cd simhash-py
git submodule update --init --recursive
Then changed the value of named parameter 'name' to simhash
from simhash-py
which was being passed to setup
method in ~/setup.py
file and then
sudo python setup.py install