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!”)?