Python3.6 BeautifulSoup无效

问题描述:

我的代码如下;

source_code = requests.get(kale_url_keys)
plain_text = source_code.text
soup = BeautifulSoup("plain_text ")

r = requests.get(kale_url_keys)
html = r.content
soup = BeautifulSoup(html, "html.parser")

我写下汤= BeautifulSoup(ANYTHING)时出错,如下所示;

I took error when I writing the "soup = BeautifulSoup(ANYTHING)" like below;

做两件事:


  • 安装最新的稳定 Python 3.6.0

  • update beautifulsoup4 - 确保在正确的Python 3.6.0环境中更新它:

  • install the latest stable Python 3.6.0
  • update beautifulsoup4 - make sure you update it in the correct Python 3.6.0 environment:

pip3 install beautifulsoup4 --upgrade