Pycharm似乎接受bs4,但不能识别漂亮的汤-即使我已经确定它是通过命令终端中的pip和miniconda安装的。我还去了pycharm中的设置,并已经安装了软件包bs4和beautifulsoup4(使用最新版本),我正在使用Python 3.9。以下是我收到的错误消息:
C:\Users\joe_h\AppData\Local\Programs\Python\Python39\python.exe C:/Users/joe_h/AppData/Roaming/JetBrains/PyCharmCE2020.3/scratches/scratch.py
Traceback (most recent call last):
File "C:\Users\joe_h\AppData\Roaming\JetBrains\PyCharmCE2020.3\scratches\scratch.py", line 1, in <module>
from bs4 import beautifulsoup4
ImportError: cannot import name 'beautifulsoup4' from 'bs4' (C:\Users\joe_h\AppData\Roaming\Python\Python39\site-packages\bs4\__init__.py)
Process finished with exit code 1
而不是尝试
from bs4 import beautifulsoup4
(这是错误的方法)
相反做
from bs4 import BeautifulSoup
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句