找不到lxml,请将其安装在@Colaboratory中

CHA*_*LEE 1 python lxml google-colaboratory

我正试图在谷歌Colaboratory上移植我的代码.即便如此,这也很奇怪

!pip3 install xml 
Run Code Online (Sandbox Code Playgroud)

在我的代码中.它仍然需要我安装lxml.

有人有问题吗?

****Requirement already satisfied: lxml in /usr/local/lib/python3.6/dist-packages****
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-17-eda66c9ec97a> in <module>()
     48 #df = financial_statement(2017,3)
...
/usr/local/lib/python3.6/dist-packages/pandas/io/html.py in _parser_dispatch(flavor)
    695     else:
    696         if not _HAS_LXML:
--> 697             raise ImportError("lxml not found, please install it")
    698     return _valid_parsers[flavor]
    699 

**ImportError: lxml not found, please install it**


**code:**

!pip3 install lxml

import requests

import pandas as pd

import numpy as np

import keras

import lxml

import html5lib

from bs4 import BeautifulSoup

f_states=   pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states') 
Run Code Online (Sandbox Code Playgroud)

Moh*_*had 5

安装后使用pip或apt,需要使用"Runtime/Restart runtime ..."重新启动运行时.