python3.7导入BeautifulSoup报错

在PyCharm中将项目解释器从Python2.7切换到Python3.7后,导入BeautifulSoup时遇到错误。通过尝试使用Alt+Enter自动导入和手动在项目解释器中安装beautifulsoup4,最终成功解决报错问题。
摘要由CSDN通过智能技术生成

python 爬虫用BeautifulSoup

将pycharm的项目解释器由python2.7更换为python3.7,BeautifulSoup包报错

之前使用python2.7时,PyCharm用快捷键Alt+Enter就可以轻松导入BeautifulSoup;但是将项目解释器变为python3.7后,需要导入BeautifulSoup4

python2.7导入BeautifulSoup

当python版本为2.7时,使用BeautifulSoup时,在PyCharm中使用快捷键Alt+Eneter,自动导入成功from bs4 import BeautifulSoup

将pycharm的项目解释器由python2.7更换为python3.7,BeautifulSoup包报错

1、将PyCharm的项目解释器由python2.7更换为python3.7
PyCharm -> preferences -> Project Interpreter -> Python 3.7
2、运行,报错:ModuleNotFoundError: No module named ‘bs4’
3、在PyCharm中使用快捷键Alt+Eneter:Install Package BeautifulSoup
安装失败,点开详细:SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(“Unit tests have failed!”)?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值