Seite 1 von 1

Installation von Levenshtein

Verfasst: Donnerstag 24. Januar 2013, 18:50
von Apotekarnes
Hallo liebe Pythonfreunde,

ich versuche das Paket Levenshtein (String-Vergleiche...) zu installieren.

Folgendes habe ich probiert:

Wechsel in den Ordner des Packages und dann:
"sudo python setup.py install"

Da bekomme ich diesen Fehler:
running install
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing requirements to python_Levenshtein.egg-info/requires.txt
writing python_Levenshtein.egg-info/PKG-INFO
writing namespace_packages to python_Levenshtein.egg-info/namespace_packages.txt
writing top-level names to python_Levenshtein.egg-info/top_level.txt
writing dependency_links to python_Levenshtein.egg-info/dependency_links.txt
writing entry points to python_Levenshtein.egg-info/entry_points.txt
reading manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
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
writing manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'Levenshtein' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c Levenshtein.c -o build/temp.linux-x86_64-2.7/Levenshtein.o
Levenshtein.c:99:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1


Ebenso wenn ich eingebe
"sudo easy_install python-Levenshtein"

bekomme ich:

Searching for python-Levenshtein
Reading http://pypi.python.org/simple/python-Levenshtein/
Reading http://trific.ath.cx/resources/python/levenshtein/
Download error on http://trific.ath.cx/resources/python/levenshtein/: [Errno -2] Name or service not known -- Some packages may not be found!
Reading http://github.com/miohtama/python-Levenshtein
Best match: python-Levenshtein 0.10.2
Downloading http://pypi.python.org/packages/source/ ... 4ee677bbb8
Processing python-Levenshtein-0.10.2.tar.gz
Running python-Levenshtein-0.10.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vKGrog/python-Levenshtein-0.10.2/egg-dist-tmp-bXH_RJ
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
Levenshtein.c:99:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
ralf@ralf-VirtualBox:~/Desktop/Documents/software/python-Levenshtein-0.10.2$


Was kann ich tun, um Levenshtein erfolgreich zu installieren?


Vielen Dank,

Apotekarnes

Re: Installation von Levenshtein

Verfasst: Donnerstag 24. Januar 2013, 19:13
von BlackJack
@Apotekarnes: Das Paket enthält offenbar C-Quelltext und braucht deshalb einen C-Compiler um installiert werden zu können.

Re: Installation von Levenshtein

Verfasst: Donnerstag 24. Januar 2013, 19:34
von pillmuncher
Wenn gcc die Datei Python.h nicht findet, dann vermutlich, weil die Python-Sources nicht installiert sind. Die kannst du über den Package-Manager deiner Linux (oder BSD, oder ...) - Distribution nachinstallieren.

Re: Installation von Levenshtein

Verfasst: Freitag 25. Januar 2013, 07:22
von Apotekarnes
Danke für eure beiden guten Antworten!

Nachdem ich im Paket-Manager von Ubuntu keine "Python-Sources" finden konnte, habe ich nach kurzem Googlen "Python-dev" installiert, was hinreichend war. Danach war Python.h vorhanden und Levenshtein konnte installiert werden.

Danke!

Re: Installation von Levenshtein

Verfasst: Freitag 25. Januar 2013, 11:24
von noisefloor
Hallo,

das Paket heißt auch unter Ubuntu - wenig verwunderlich - "python-dev" (http://packages.ubuntu.com/search?keywo ... ection=all. Bzw. für Python3 "python3-dev".

Bei Ubuntu / Debian haben die Entwicklerpakete, die du zum Kompilieren braucht, üblicherweise das Suffix "-dev".

Gruß, noisefloor