【问题标题】:"ImportError: lxml not found, please install it" after installing lxml using VS Code\"ImportError: lxml not found, please install it\" 使用 VS Code 安装 lxml 后
【发布时间】:2022-08-19 05:29:02
【问题描述】:

我在 VS Code 中使用带有 python 版本 3.9.9 的虚拟环境,即使在我 pip install lxml 之后仍然收到相同的错误。我能够在 jupyter notebook 中使用 python 3.8.8 成功地做到这一点,但无法弄清楚如何在这个新环境中做到这一点。 这是我的代码:

import pandas as pd

url = \'https://en.wikipedia.org/wiki/Young_Thug\'
df = pd.read_html(url)[0]

这是我的错误:

>>> import pandas as pd
>>> ml_url = \'https://en.wikipedia.org/wiki/Young_Thug\'
>>> ml_df_original = pd.read_html(ml_url)
Traceback (most recent call last):
  File \"<stdin>\", line 1, in <module>
  File \"C:\\Users\\main\\pyenvs\\py39ve\\lib\\site-packages\\pandas\\util\\_decorators.py\", line 311, in wrapper
    return func(*args, **kwargs)
  File \"C:\\Users\\main\\pyenvs\\py39ve\\lib\\site-packages\\pandas\\io\\html.py\", line 1113, in read_html
    return _parse(
  File \"C:\\Users\\main\\pyenvs\\py39ve\\lib\\site-packages\\pandas\\io\\html.py\", line 915, in _parse
    parser = _parser_dispatch(flav)
  File \"C:\\Users\\main\\pyenvs\\py39ve\\lib\\site-packages\\pandas\\io\\html.py\", line 872, in _parser_dispatch
    raise ImportError(\"lxml not found, please install it\")
ImportError: lxml not found, please install it

我尝试了this 页面上的所有建议,但没有任何效果。感谢任何能提供帮助的人。

    标签: python pandas visual-studio


    【解决方案1】:

    正如我们在这个blog 中看到的,错过安装lxml打包,试试:

    pip install lxml
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-02
      • 2016-02-29
      • 2015-01-16
      • 2019-01-11
      • 1970-01-01
      • 1970-01-01
      • 2015-09-14
      相关资源
      最近更新 更多