分享技术,记录生活,在互联网上留下属于自己的一亩三分地。

Deepin15.5安装lxml和beautifulsoup4

默认笔记 novadmin 423℃ 0评论

使用pip3在Deepin15.5系统中安装lxml和beautifulsoup4

1、安装lxml和beautifulsoup4


zhj@zhj-PC:~/two$ pip3 install lxml
Collecting lxml
  Downloading https://files.pythonhosted.org/packages/30/65/6dcc7a1a0ec3bbc10a1316b3610f9997ca132183a5f5345c5b88fc1eaf79/lxml-4.2.1-cp35-cp35m-manylinux1_x86_64.whl (5.6MB)
    100% |████████████████████████████████| 5.6MB 222kB/s 
Installing collected packages: lxml
Successfully installed lxml-4.2.1
zhj@zhj-PC:~/two$ sudo pip3 install beautifulsoup4
Collecting beautifulsoup4
  Downloading https://files.pythonhosted.org/packages/9e/d4/10f46e5cfac773e22707237bfcd51bbffeaf0a576b0a847ec7ab15bd7ace/beautifulsoup4-4.6.0-py3-none-any.whl (86kB)
    100% |████████████████████████████████| 92kB 480kB/s 
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.6.0

看到有Successfully表示安装成功

2、验证安装


zhj@zhj-PC:~/two$ python3
Python 3.5.4rc1 (default, Jul 25 2017, 08:53:34) 
[GCC 6.4.0 20170704] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
>>> 

如果导入成功,没有报错,说明lxml已经安装成功。

用下面代码验证beautifulsoup4。


from bs4 import BeautifulSoup
soup = BeautifulSoup('<p>Hello</p>', 'lxml')
print(soup.p.string)

运行成功则得出

Hello。

转载请注明:Nov » Deepin15.5安装lxml和beautifulsoup4

喜欢 (0)or分享 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址