Search code examples
pythonimporteasy-installlevenshtein-distance

Importing modules, Levenshtein


I'm working on a script that uses comparisons to determine fuzzy-matching, so I'm using the Levenshtein feature.

Unfortunately, when I run easy_install python-Levenshtein in the Terminal window, Python still doesn't recognize Levenshtein when I run an import on it. When I look at the terminal window, I get these list of error codes (I think this is where it's going wrong):

Processing python-Levenshtein-0.10.2.tar.gz

Running python-Levenshtein-0.10.2/setup.py -q bdist_egg --dist-dir /var/folders/0H/0HiEtyHBGV4TWfq84ctWC++++TM/-Tmp-/easy_install-tbdn73/python-Levenshtein-0.10.2/egg-dist-tmp-L7Jws0 warning: no files found matching '*' under directory 'docs'

warning: no previously-included files matching '*pyc' found anywhere in distribution

warning: no previously-included files matching '.project' found anywhere in distribution

warning: no previously-included files matching '.pydevproject' found anywhere in distribution

unable to execute gcc-4.0: No such file or directory

error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

Does anyone know why the Levenshtein install isn't working? I think it has something to do with the gcc-4.0 error (I ran a GCC installer, but it still doesn't work), or have any suggestions?


Solution

  • The giveaway is this line:

    unable to execute gcc-4.0: No such file or directory
    

    This is a hint that you don't have the OS X developer tools installed. You'll need to download them from Apple. If you're lucky, you'll be able to find a download for the command-line tools only, which is all you need - otherwise you'll have to download the whole of XCode, which is several gigabytes.