libxml erreur d'installation à l'aide de pip
C'est mon erreur:
(mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install lxml
Downloading/unpacking lxml
Running setup.py egg_info for package lxml
Building lxml version 2.3.
Building without Cython.
ERROR: /bin/sh: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
Installing collected packages: lxml
Running setup.py install for lxml
Building lxml version 2.3.
Building without Cython.
ERROR: /bin/sh: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:4: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/lxml/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-jOhgvD-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6:
Building lxml version 2.3.
Building without Cython.
ERROR: /bin/sh: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
running install
running build
running build_py
running build_ext
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:4: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/lxml/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-jOhgvD-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6 failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log
Que puis-je faire?
mise à jour:
(mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install lxml
Downloading/unpacking lxml
Running setup.py egg_info for package lxml
Building lxml version 2.3.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
Installing collected packages: lxml
Running setup.py install for lxml
Building lxml version 2.3.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:4: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/lxml/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-NJw2ws-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6:
Building lxml version 2.3.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
running install
running build
running build_py
running build_ext
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:4: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/lxml/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-NJw2ws-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6 failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log
le journal:
------------------------------------------------------------
/home/zjm1126/zjm_test/mysite/bin/pip run on Thu Mar 3 17:07:27 2011
Downloading/unpacking mysql-python
Running setup.py egg_info for package mysql-python
running egg_info
creating pip-egg-info/MySQL_python.egg-info
writing pip-egg-info/MySQL_python.egg-info/PKG-INFO
writing top-level names to pip-egg-info/MySQL_python.egg-info/top_level.txt
writing dependency_links to pip-egg-info/MySQL_python.egg-info/dependency_links.txt
writing pip-egg-info/MySQL_python.egg-info/PKG-INFO
writing top-level names to pip-egg-info/MySQL_python.egg-info/top_level.txt
writing dependency_links to pip-egg-info/MySQL_python.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/MySQL_python.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'pip-egg-info/MySQL_python.egg-info/SOURCES.txt'
Installing collected packages: mysql-python
Running setup.py install for mysql-python
Running command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-XuVIux-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.6
copying _mysql_exceptions.py -> build/lib.linux-i686-2.6
creating build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.6/MySQLdb
creating build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX
In file included from _mysql.c:29:
pymemcompat.h:10: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-XuVIux-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6:
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.6
copying _mysql_exceptions.py -> build/lib.linux-i686-2.6
creating build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.6/MySQLdb
creating build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX
In file included from _mysql.c:29:
pymemcompat.h:10: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-XuVIux-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6 failed with error code 1
Exception information:
Traceback (most recent call last):
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/basecommand.py", line 130, in main
self.run(options, args)
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/commands/install.py", line 228, in run
requirement_set.install(install_options, global_options)
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/req.py", line 1043, in install
requirement.install(install_options, global_options)
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/req.py", line 559, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/__init__.py", line 249, in call_subprocess
% (command_desc, proc.returncode))
InstallationError: Command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-XuVIux-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6 failed with error code 1
- Il s'est avéré être un problème de mémoire. Veuillez vous référer à cette stackoverflow.com/a/26762938/578989
Vous devez vous connecter pour publier un commentaire.
De la lxml documentation, en supposant que vous utilisez une distribution basée sur Debian :
Pour les systèmes basés sur Debian, il suffit d'installer le sait construire les dépendances de
python-lxml
oupython3-lxml
, par exemplePython.h
est manquant, donc installer python2.6-dev trop:sudo apt-get install python2.6-dev
Cela a fonctionné pour moi:
pact install libxslt-devel libxml2-devel
pour Babun).error: command 'gcc' failed with exit status 4
sur un Centos 7 serveur avec python 3.4 environnement virtuel. Avez-vous des indices? stackoverflow.com/questions/34825789/...sudo apt-get install libxslt-dev
Dans le cas, vous utilisez Ubuntu/Lubuntu 13.04 ou Ubuntu 13.10 et avoir des problèmes avec "/usr/bin/ld: ne peut trouver -lz", vous devrez également installer zlib1g-dev package:
Mettre tout cela ensemble:
zlib1g-dev
a été l'absence lib pour moi aussi, sur Ubuntu 14.04.Ne vous manque le Python fichiers d'en-tête. Cela se produit principalement sur Linux lorsque vous utilisez le système de Python (il y a raisons de ne pas le faire, mais c'est une autre question).
Vous avez probablement besoin d'installer le paquet, et c'est probablement python-dev ou python-devel.
ou
Ou somesuch.
python2.6-dev
.python3-dev
de travailler sur python3J'ai résolu ce problème en augmentant mon serveur ram.
J'étais en train de seulement 512 MO et quand j'ai mis à 1 GO je n'ai eu aucun problème.
J'ai aussi installé tous les paquets manuellement avant cela, dans une tentative pour résoudre le problème, mais je ne suis pas sûr de savoir si c'est une étape nécessaire.
Sur Windows j'ai eu le même message d'erreur sur windows lorsque vous essayez d'installer manuellement en Python 3.4 après qu'il a été installé sur 3.3. J'ai finalement été en mesure de le résoudre par l'installation de la roue et en cours d'exécution du pip de l'Python34 répertoire.
1) télécharger la roue à partir d'ici: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
2)
cd Python34\Scripts
3)
pip.exe C:\Users\Home\Downloads\lxml- ......... .whl
pip.exe install C:\Users\<user>\Downloads\lxml-3.6.4-cp35-cp35m-win_amd64.whl
il suffit d'installer exigences:
Maintenant, vous pouvez l'installer avec le pip outil de gestion de paquets:
J'utilise Ubuntu 14.04 et cela résout le problème pour moi
L'installation d'un lxml binaire ferait l'affaire. Cochez cette
J'ai eu ce problème avec un pip install de lxml. Mon CentOS exemple a l'aide de la version 2.6 de python qui jetait cette erreur.
Pour contourner ce problème j'ai fait la suivante à exécuter avec Python 2.7:
sudo yum install python-devel
sudo yum install libxslt-devel libxml2-devel
/usr/bin/python2.7 YOUR_PYTHON_COMMAND
(Pour moi, c'était
/usr/bin/python2.7 -m pip install lxml
)et puis essayez de mettre à niveau python setuptools
cela devrait résoudre le problème.
pymemcompat.h:10: fatal error: Python.h: 没有那个文件或目录
Garçon, vous devriez poster votre journal des erreurs avec
LANG=C
ou les gens ne peuvent pas obtenir la vraie cause de votre journal. Le journal ci-dessus, dit: Aucun fichier ou répertoire.Cela signifie que vous devez installer le développer ensemble de Python. C'est généralement "python-dev" sur Debian saveur de distribution, et "python-devel" sur RHEL saveur de distribution.
Toutes les réponses ci-dessus supposent que l'utilisateur a accès à un privilégié/compte root pour installer les bibliothèques nécessaires. Pour l'installer en local, vous devez faire les étapes suivantes. Seulement montré la vue d'ensemble depuis les étapes peut être un peu impliqué, selon les dépendances que vous pourriez être absent
1.Télécharger et Compiler libxml2-2.9.1 & libxslt-1.1.28(versions changent)
2.Configurer chaque chemin d'installation pour les deux libxml et libxslt pour être certains de répertoire local à l'aide de configurer. Ex.
./configure --prefix=/home_dir/dependencies/libxslt_path
3.Exécuter
make
puismake install
4.Télécharger et compiler lxml à partir de la source
Cela fonctionne pour moi, 12.04, python2.7.6
Je sais je suis en retard pour le spectacle,
Mais cela permettra si rien d'autre ne fonctionne
Réglage TMPDIR permettra de s'assurer que la construction peut exécuter tout ce qu'il a besoin pour fonctionner, et la mise STATIC_DEPS va dire pour le tirer de son propre libxml2 et
libxslt2, au lieu d'utiliser les anciennes versions installées sur le serveur.
L'utilisation de cygwin 64 avec Windows 8.
J'ai...
J'ai tout essayé jusqu'à ce que j'ai réalisé une nouvelle cygwin toolchain a foiré python logique. cygwin installer un compilateur appelé "realgcc" qui n'est pas un réel gcc.
Solution
Installer gcc. Ex:
La seule chose qui a aidé à m'était
J'ai eu le même message d'erreur sur ma machine Linux.Si vous allez à la leur site web c'est dans leur documentation.Donc, si vous obtenez ce genre d'erreur dans machine Linux, s'il vous plaît essayer ces commandes,
# apt install libxml2-dev libxslt-dev python-dev
# pip install lxml==3.4.4
J'utilise Ubuntu 12, et cela fonctionne pour moi:
Si vous avez installé la libxml2 et libxslt, peut-être vous avez besoin de créer un lien symbolique entre libxml2 et libxslt chemin de python2.6 chemin de l'. Aussi, vous pouvez essayer d'ajouter: environnement argument.
Parce que la gcc uniquement la commande de recherche de ce chemin d'accès: -I/usr/include/python2.6.
Le fichier ci-dessous a fonctionné pour moi sur windows
https://pypi.python.org/pypi/lxml/3.3.3#downloads
Sur osx 10.10.5 et dans un virtualenv, peut-être que vous pouvez résoudre ce problème comme ci-dessous:
Je travaille sur une machine Windows. Et voici quelques conseils pour réussir l'installation d'lxml (avec python 2.6 et plus tard).
Avoir installé les éléments suivants:
Tous ne sont pas disponibles à un
pip install
.libxml2 windows binaire est trouvé ici.
libxslt est trouvé ici.
Après vous avez terminé avec les deux ci-dessus,
faire :
pip install lxml
.Une autre solution est d'utiliser les versions stables depuis PyPI ou le non-officiel des binaires pour Windows par Christoph Gohlke (trouvé ici).
À l'aide de Windows 7 avec Cygwin, je suis tombé sur:
Je l'ai corrigé en installant
mingw64-x86_64-libxslt
Pour Windows: