我已经运行pip install pandas
并且似乎收到了大量的警告,但最终似乎已经成功安装了所有内容。我也跑pip install requests
。
当我用这一行调用函数时:
getTeamRoster("http://modules.ussquash.com/ssm/pages/leagues/Team_Information.asp?id=11325")
我收到此错误(似乎不喜欢read_html调用并要我安装lxml?):
Traceback (most recent call last):
File "SquashScraper.py", line 51, in <module>
main()
File "SquashScraper.py", line 48, in main
getTeamRoster("http://modules.ussquash.com/ssm/pages/leagues/Team_Information.asp?id=11325")
File "SquashScraper.py", line 39, in getTeamRoster
tables = pd.read_html(requests.get(teamURL).content)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pandas/io/html.py", line 865, in read_html
parse_dates, tupleize_cols, thousands, attrs, encoding)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pandas/io/html.py", line 718, in _parse
parser = _parser_dispatch(flav)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pandas/io/html.py", line 677, in _parser_dispatch
raise ImportError("lxml not found, please install it")
ImportError: lxml not found, please install it
有什么想法在这里发生了什么?
如果需要,很高兴提供更多信息。
谢谢, bclayman
编辑添加:
pip install让我:error: command '/usr/bin/clang' failed with exit status 1 Command /usr/local/bin/python3 -c "import setuptools, tokenize;__file__='/private/var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip_build_ben/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip-fn3n3u-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip_build_ben/lxml
答案 0 :(得分:3)
请注意,您收到以下错误消息:
ImportError: lxml not found, please install it
这意味着您需要在Linux上安装python-lxml
软件包。
sudo apt-get -y install python-lxml
sudo yum -y install python-lxml
brew install libxml2
brew install libxslt
STATIC_DEPS=true sudo pip install lxml
答案 1 :(得分:0)
如果您使用的是Mac,则必须下载并安装开发人员工具,这可以通过以下命令实现:
xcode-select --install
在我执行pip install lxml