【发布时间】:2017-01-14 11:42:40
【问题描述】:
我对 python 和 pandas 真的很陌生,所以我可能会犯一个简单的错误。
我正在尝试运行以下代码:
import quandl
import pandas as pd
df3 = pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states')
print(df3)
我已经通过 pip 安装了 pandas 以及 quandl。 当我运行代码时,出现以下错误:
Traceback (most recent call last):
File "C:\Python27\FunwithQuandl.py", line 14, in <module>
df3 = pd.read_html('https://simple.wikipedia.org /wiki/List_of_U.S._states')
File "C:\Python27\lib\site-packages\pandas\io\html.py", line 874, in read_html
parse_dates, tupleize_cols, thousands, attrs, encoding)
File "C:\Python27\lib\site-packages\pandas\io\html.py", line 726, in _parse
parser = _parser_dispatch(flav)
File "C:\Python27\lib\site-packages\pandas\io\html.py", line 685, in _parser_dispatch
raise ImportError("lxml not found, please install it")
ImportError: lxml not found, please install it
然后我尝试通过命令提示符和 pip 安装 lxml,但出现了一些错误:
Cannnot open include file: 'libxml/xpath.h': No such file or directory
Could not find function xmlCheckVersion in library libxm12. Is libxml2 installed?
error: command 'CL\\User\\...Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
我什至尝试过 this thread 的建议:
如
"从 lfd.uci.edu/~gohlke/pythonlibs/#lxml 安装 lxml 蟒蛇版本。这是一个预编译的 WHL,需要 模块/依赖项。
该网站列出了几个包,例如使用 Win32 Python 2.7,使用 lxml-3.6.1-cp27-cp27m-win32.whl。”
我已从建议的站点下载了 whl 文件,但我似乎无法安装它。 我曾尝试使用 pip 并输入文件名,但无法通过 pip 识别该文件。
我正在使用 Python 2.7 和 Windows 7 专业版
感谢您的帮助。
【问题讨论】:
标签: python windows python-2.7 pandas pip