博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Python xlrd.biffh.XLRDError: Excel xlsx file; not supported

Posted on 2021-07-23 11:44  小翁好  阅读(499)  评论(0)    收藏  举报

处xlsl格式的excel文件时,报错:

File "D:\Python37\lib\site-packages\xlrd\__init__.py", line 170, in open_workbook

raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
xlrd.biffh.XLRDError: Excel xlsx file; not supported

问题原因:

  安装的 xlrd-2.0.1,该版本只支持.xls文件

  使用 pd.read_excel("2015Cities-CHINA.xlsx") 报错

解决方法:

  卸载当前安装的xlrd

pip uninstall xlrd

  安装低版本的xlrd

pip install xlrd==1.2.0