2014-10-10 13 views
6

Verwendung Dies ist der Befehl, den ich verwenden lxml zu installieren:Ausfallen lxml zu installieren pip

sudo pip install lxml 

Und ich habe die folgende Meldung in der Säuberungsstufe:

Cleaning up... 
Command /usr/bin/python -c "import setuptools,  tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml 
Storing debug log for failure in /Users/georgejor/Library/Logs/pip.log 

Danach bekam ich :

ImportError: No module named lxml 

Bitte helfen Sie. Vielen Dank!

Die folgende Ausgabe von pip.log ist:

---------------------------------------- 
Cleaning up... 
    Removing temporary dir /private/tmp/pip_build_root... 
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml 
Exception information: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 283, in run 
    requirement_set.install(install_options, global_options, root=options.root_path) 
    File "/Library/Python/2.7/site-packages/pip/req.py", line 1435, in install 
    requirement.install(install_options, global_options, *args, **kwargs) 
    File "/Library/Python/2.7/site-packages/pip/req.py", line 706, in install 
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
    File "/Library/Python/2.7/site-packages/pip/util.py", line 697, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rUFjFN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml 
+0

Das bedeutet, dass 'lxml' wurde nicht richtig installiert. Tun Sie dies 'cat/Users/georgejor/Library/Logs/pip.log' und zeigen Sie uns das in der Frage. –

+0

Ok, ich habe gerade hinzugefügt. Ich hoffe, es kann helfen. –

+0

Es sieht so aus, als ob du setuptools nicht installiert hast. Installiere setuptools mit 'pip install setuptools' –

Antwort

0

lxml hat depenedencies C, oft ich in Probleme laufen, wenn ich libxslt oder libxml2 fehlt. Sind Sie sicher, dass alle Nicht-Python-Abhängigkeiten installiert sind?

+0

Ich bin auf Linux, versuche, llvmlite zu installieren und das hat nicht für mich funktioniert – gota

11

Installieren Sie einfach diese Dinge:

sudo apt-get install libxml2-dev libxslt-dev python-dev python-setuptools 

Dann versuchen Sie es erneut:

pip install lxml 
+0

das hat für mich funktioniert. Obwohl ich verschiedene Programme blind kopiere, um sie zu installieren, habe ich keine Ahnung, dass es keine gute Idee ist, aber es hat funktioniert :-) – Martin