LINUX.ORG.RU

установить lxml

 , ,


1

2

подскажите пожалуйста как установить библиотеку lxml в linux mint

я деалю следующее: в .profile добавляю:

export WORKON_HOME=$HOME/.virtualenvs/moda_project
export PROJECT_HOME=$HOME/.virtualenvs/moda_project/moda

не забываю сделать:

source .profile

затем активирую виртуальное окружение и в соответствии с этим выполняю в консоли:

pip install lxml

в результате получаю следующее сообщение(привожу только последний фрагмент):

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

creating build/temp.linux-x86_64-3.4

creating build/temp.linux-x86_64-3.4/src

creating build/temp.linux-x86_64-3.4/src/lxml

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/src/lxml/includes -I/usr/include/python3.4m -I/home/kalinin/.virtualenvs/moda_project/moda_env/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w

In file included from src/lxml/lxml.etree.c:239:0:

/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory

 #include "libxml/xmlversion.h"

                               ^

compilation terminated.

/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'

  warnings.warn(msg)

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/kalinin/.virtualenvs/moda_project/moda_env/bin/python3 -c "import setuptools, tokenize;__file__='/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-o720z8dc-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/kalinin/.virtualenvs/moda_project/moda_env/include/site/python3.4 failed with error code 1 in /home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml
Storing debug log for failure in /home/kalinin/.pip/pip.log



Последнее исправление: cetjs2 (всего исправлений: 1)

On Linux (and most other well-behaved operating systems), pip will manage to build the source distribution as long as libxml2 and libxslt are properly installed, including development packages, i.e. header files, etc. Use your package management tool to look for packages like libxml2-dev or libxslt-devel if the build fails, and make sure they are installed. Alternatively, setting STATIC_DEPS=true will download and build both libraries automatically.

anonymous
()

libxml поставь и заголовочные хедеры к нему.

Deleted
()
Ответ на: комментарий от anatoly

да. всё пробовал. вот листинг:

(moda_env)kalinin@kalinin ~/.virtualenvs/moda_project/moda $ pip install libxml
Downloading/unpacking libxml
  Could not find any downloads that satisfy the requirement libxml
Cleaning up...
No distributions at all found for libxml
Storing debug log for failure in /home/kalinin/.pip/pip.log
(moda_env)kalinin@kalinin ~/.virtualenvs/moda_project/moda $ pip install libxml2-dev
Downloading/unpacking libxml2-dev
  Could not find any downloads that satisfy the requirement libxml2-dev
Cleaning up...
No distributions at all found for libxml2-dev
Storing debug log for failure in /home/kalinin/.pip/pip.log
(moda_env)kalinin@kalinin ~/.virtualenvs/moda_project/moda $ pip install libxslt-devel
Downloading/unpacking libxslt-devel
  Could not find any downloads that satisfy the requirement libxslt-devel
Cleaning up...
No distributions at all found for libxslt-devel
Storing debug log for failure in /home/kalinin/.pip/pip.log
(moda_env)kalinin@kalinin ~/.virtualenvs/moda_project/moda $ sudo apt-get install libxml2-dev
[sudo] password for kalinin: 
Чтение списков пакетов… Готово
Построение дерева зависимостей       
Чтение информации о состоянии… Готово
Следующие пакеты устанавливались автоматически и больше не требуются:
  gyp libc-ares-dev libc-ares2 libjs-node-uuid libv8-3.14-dev libv8-3.14.5
  node-abbrev node-ansi node-archy node-async node-block-stream
  node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent
  node-form-data node-fstream node-fstream-ignore node-github-url-from-git
  node-glob node-graceful-fs node-gyp node-inherits node-ini
  node-json-stringify-safe node-lockfile node-lru-cache node-mime
  node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  node-normalize-package-data node-npmlog node-once node-osenv node-qs
  node-read node-read-package-json node-request node-retry node-rimraf
  node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
  node-which
Для их удаления используйте «apt-get autoremove».
НОВЫЕ пакеты, которые будут установлены:
  libxml2-dev
обновлено 0, установлено 1 новых пакетов, для удаления отмечено 0 пакетов, и 47 пакетов не обновлено.
Необходимо скачать 630 kБ архивов.
После данной операции, объём занятого дискового пространства возрастёт на 2 928 kB.
Получено:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libxml2-dev amd64 2.9.1+dfsg1-3ubuntu4.4 [630 kB]
Получено 630 kБ за 1с (427 kБ/c)     
Выбор ранее не выбранного пакета libxml2-dev:amd64.
(Чтение базы данных … на данный момент установлено 167726 файлов и каталогов.)
Preparing to unpack …/libxml2-dev_2.9.1+dfsg1-3ubuntu4.4_amd64.deb ...
Unpacking libxml2-dev:amd64 (2.9.1+dfsg1-3ubuntu4.4) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Настраивается пакет libxml2-dev:amd64 (2.9.1+dfsg1-3ubuntu4.4) …
(moda_env)kalinin@kalinin ~/.virtualenvs/moda_project/moda $ pip install lxml
Downloading/unpacking lxml
  Downloading lxml-3.4.1.tar.gz (3.5MB): 3.5MB downloaded
  Running setup.py (path:/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/setup.py) egg_info for package lxml
    Building lxml version 3.4.1.
    Building without Cython.
    ERROR: b'/bin/sh: 1: xslt-config: not found\n'
    ** make sure the development packages of libxml2 and libxslt are installed **
    
    Using build configuration of libxslt
    /usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    
    warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
  Running setup.py install for lxml
    Building lxml version 3.4.1.
    Building without Cython.
    ERROR: b'/bin/sh: 1: xslt-config: not found\n'
    ** make sure the development packages of libxml2 and libxslt are installed **
    
    Using build configuration of libxslt
    building 'lxml.etree' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/src/lxml/includes -I/usr/include/python3.4m -I/home/kalinin/.virtualenvs/moda_project/moda_env/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w
    In file included from src/lxml/lxml.etree.c:239:0:
    /home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
     #include "libxml/xmlversion.h"
                                   ^
    compilation terminated.
    /usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /home/kalinin/.virtualenvs/moda_project/moda_env/bin/python3 -c "import setuptools, tokenize;__file__='/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-h4xdnton-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/kalinin/.virtualenvs/moda_project/moda_env/include/site/python3.4:
    Building lxml version 3.4.1.

Building without Cython.

ERROR: b'/bin/sh: 1: xslt-config: not found\n'

** make sure the development packages of libxml2 and libxslt are installed **



Using build configuration of libxslt

..................................
..................................
..................................
..................................
..................................



creating build/temp.linux-x86_64-3.4/src/lxml

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/src/lxml/includes -I/usr/include/python3.4m -I/home/kalinin/.virtualenvs/moda_project/moda_env/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w

In file included from src/lxml/lxml.etree.c:239:0:

/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory

 #include "libxml/xmlversion.h"

                               ^

compilation terminated.

/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'

  warnings.warn(msg)

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/kalinin/.virtualenvs/moda_project/moda_env/bin/python3 -c "import setuptools, tokenize;__file__='/home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-h4xdnton-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/kalinin/.virtualenvs/moda_project/moda_env/include/site/python3.4 failed with error code 1 in /home/kalinin/.virtualenvs/moda_project/moda_env/build/lxml
Storing debug log for failure in /home/kalinin/.pip/pip.log
(moda_env)kalinin@kalinin ~/.virtualenvs/moda_project/moda $ 

prozaik
() автор топика
Ответ на: комментарий от prozaik

Установка python-lxml уже дает возможность использовать lxml в python'е. Но в то же время она (установка python-lxml) не является достаточным условием для установки lxml из pip'а.

anatoly
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.