beautifulsoup won't recognize lxml

人走茶凉 提交于 2019-11-29 03:43:21

It looks like lxml has not been successfully installed. To install lxml on Ubuntu, run

sudo apt-get install libxslt1-dev libxml2

In virtualenv:

pip install --upgrade lxml
pip install cssselect

Go to these pages:

  1. https://pypi.python.org/pypi/cssselect

  2. https://pypi.python.org/pypi/lxml/3.2.5

download the source files for both packages. Expand each of them into a different folder. Then in each folder locate the setup.py file and run the following command:

python setup.py install

You may run into some problems with lxml. If you get an error like

error: command 'gcc' failed with exit status 1

make sure you install libxml2-dev & libxslt1-dev using

sudo apt-get install libxml2-dev libxslt1-dev

Hopefully that should work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!