使用pip安装BeautifulSoup4模块

1.测试是否安装了BeautifulSoup4模块

import bs4
print bs4

执行报错说明没有安装该模块

Traceback (most recent call last):
  File "D:\work_java\python\src\baike_spider\test.py", line 7, in <module>
    import bs4
ImportError: No module named bs4

 

2.使用pip安装BeautifulSoup4模块

 C:\Python27\Scripts 的目录

2015/09/11  09:51    <DIR>          .
2015/09/11  09:51    <DIR>          ..
2015/09/11  09:51            95,592 easy_install-2.7.exe
2015/09/11  09:51            95,592 easy_install.exe
2015/09/11  09:51            95,564 pip.exe
2015/09/11  09:51            95,564 pip2.7.exe
2015/09/11  09:51            95,564 pip2.exe
               5 个文件        477,876 字节
               2 个目录 75,941,163,008 可用字节

C:\Python27\Scripts>pip install beautifulsoup4
You are using pip version 7.0.1, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting beautifulsoup4
  Downloading beautifulsoup4-4.4.1-py2-none-any.whl (81kB)
    100% |████████████████████████████████| 81kB 111kB/s
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.4.1

 

2.再重新测试正常

<module 'bs4' from 'C:\Python27\lib\site-packages\bs4\__init__.pyc'>

 

转载于:https://www.cnblogs.com/myrunning/p/5159509.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值