본문 바로가기
파이썬

파이썬 Ubuntu에 lxml을 설치하는 방법

by º기록 2020. 9. 29.
반응형

Ubuntu 11에서 easy_install을 사용하여 lxml을 설치하는 데 어려움이 있습니다.

$ easy_install lxml 을 입력하면 다음과 같은 결과가 나타납니다.

Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3
Downloading http://lxml.de/files/lxml-2.3.tgz
Processing lxml-2.3.tgz
Running lxml-2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7UdQOZ/lxml-2.3/egg-dist-tmp-GacQGy
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 
In file included from src/lxml/lxml.etree.c:227:0:
src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory
compilation terminated.


wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.6.27.tar.gz 를 시도하면

<successful connection info>
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /libxml2 ... done.
==> SIZE libxml2-sources-2.6.27.tar.gz ... done.
==> PASV ... done.    ==> RETR libxml2-sources-2.6.27.tar.gz ... 
No such file `libxml2-sources-2.6.27.tar.gz'.

다른 방법을 먼저 시도하면 ./ configure --prefix = / usr / local / libxslt --with-libxml-prefix = / usr / local / libxml2 가 표시되며 실패합니다. 결국 :

checking for libxml libraries >= 2.6.27... configure: error: Could not find libxml2 anywhere, check ftp://xmlsoft.org/.

libxml2 2.6.27 2.6.29 버전을 차이없이 사용해 보았습니다.

돌이켜지지 않고 sudo apt-get install libxml2-dev 를 성공적으로 수행했지만 이것은 아무것도 변경하지 않습니다.

 

해결 방법

 

Ubuntu를 사용하고 있으므로 해당 소스 패키지에 신경 쓰지 마십시오. apt-get을 사용하여 해당 개발 패키지를 설치하십시오.

apt-get install libxml2-dev libxslt1-dev python-dev

그래도 이전 버전의 lxml에 만족한다면 시도해 볼 수 있습니다.

apt-get install python-lxml

그리고 그것으로 끝납니다. :)

 

참조 페이지 https://stackoverflow.com/questions/6504810

 

 

반응형

댓글