BeautifulSoup安装以及一些错误
来源:互联网 发布:社交网络的好处知乎 编辑:程序博客网 时间:2024/06/04 18:38
- 下载
- 安装
- 导入
- Tips
下载
由于需要用到beautifulsoup,因此首先去下载:下载地址
安装
然后解压缩到D:/python目录下,打开cmd窗口,进入到解压目录下,进入 D:/python/beautifulsoup4-4.5.3/beautifulsoup4-4.5.3
python setup.py build
python setup.py install
进行安装,一开始命令首部没有输入python,结果都不成功,后来尝试加上python,安装成功
导入
进入python,然后输入
from bs4 import BeautifulSoup
结果又报错:
Traceback (most recent call last):
File “”, line 1, in
File “D:\python\beautifulsoup4-4.5.3\beautifulsoup4-4.5.3\bs4__init__.py”, line 53
‘You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.’<>’You need to convert the code, either by installing it (python setup.py install
) or by running 2to3 (2to3 -w bs4
).’
SyntaxError: invalid syntax
通过错误提示发现是版本不对应造成的,因此退出python,在cmd中输入
2to3 -w bs4
再次尝试导入,成功!
Tips
python3不再有urllib2,取而代之的是urllib.request,因此把在Python2中使用urllib2的地方全部替代为urllib.request即可
from BeautifulSoup import BeautifulSoup 总是会出错,替换为from bs4 import BeautifulSoup即可
- BeautifulSoup安装以及一些错误
- CocoaPods 的安装以及一些常见安装错误解决办法
- 安装beautifulsoup
- 安装BeautifulSoup
- beautifulsoup 安装
- BeautifulSoup安装
- BeautifulSoup 安装
- 安装beautifulsoup
- wine 安装一些windows软件的错误以及处理
- Linux下安装Oracle出现的一些错误,以及解决方法
- tensorflow 源码编译安装以及遇到的一些错误
- ubuntu安装anaconda各种错误和解决方案以及一些科普
- VSS安装以及错误
- SVN的安装与常用功能使用以及解决安装配置过程中的一些错误
- SVN的安装与常用功能使用以及解决安装配置过程中的一些错误
- SVN的安装与常用功能使用以及解决安装配置过程中的一些错误
- python BeautifulSoup 安装
- python BeautifulSoup 安装
- Android Material Design Toolbar
- POJ 1325 Machine Schedule
- PMOS管学习应用
- 霍夫曼编码 zoj 2339 Hyperhuffman
- 解决mariadb数据库服务无法开启
- BeautifulSoup安装以及一些错误
- jvm运行机制
- Andriod Service与Thread的区别
- 使用 Mockito 修改私有属性
- QMUI / QMUI_iOS框架学习(五)
- 菜鸟之路
- 史上最简单的SpringCloud教程 | 第二篇: 服务消费者(rest+ribbon)
- SEO学习笔记
- Android Service 前台