我正在努力在我的 windows10 笔记本电脑上让"beautifulsoup4"在 pycharm 中工作



Pycharm似乎接受bs4,但不识别漂亮的汤——尽管我已经确保它是通过命令终端中的pip和miniconda安装的。我还去了一些场景(在pycharm中(已经安装了bs4和beautifulsoup4包(使用最新版本(,我使用的是Python 3.9。以下是我得到的错误消息:

C:Usersjoe_hAppDataLocalProgramsPythonPython39python.exe C:/Users/joe_h/AppData/Roaming/JetBrains/PyCharmCE2020.3/scratches/scratch.py
Traceback (most recent call last):
File "C:Usersjoe_hAppDataRoamingJetBrainsPyCharmCE2020.3scratchesscratch.py", line 1, in <module>
from bs4 import beautifulsoup4
ImportError: cannot import name 'beautifulsoup4' from 'bs4' (C:Usersjoe_hAppDataRoamingPythonPython39site-packagesbs4__init__.py)
Process finished with exit code 1

而不是尝试

from bs4 import beautifulsoup4

(这是错误的做法(

而是做

from bs4 import BeautifulSoup

最新更新