Installation von Levenshtein

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
Apotekarnes
User
Beiträge: 18
Registriert: Mittwoch 21. September 2011, 10:02

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
BlackJack

@Apotekarnes: Das Paket enthält offenbar C-Quelltext und braucht deshalb einen C-Compiler um installiert werden zu können.
Benutzeravatar
pillmuncher
User
Beiträge: 1530
Registriert: Samstag 21. März 2009, 22:59
Wohnort: Pfaffenwinkel

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.
In specifications, Murphy's Law supersedes Ohm's.
Apotekarnes
User
Beiträge: 18
Registriert: Mittwoch 21. September 2011, 10:02

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!
Benutzeravatar
noisefloor
User
Beiträge: 4187
Registriert: Mittwoch 17. Oktober 2007, 21:40
Wohnort: WW
Kontaktdaten:

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
Antworten