是因为安装的xlrd版本异常导致。
原因:xlrd更新到了2.0.1版本,只支持.xls文件,不支持.xlsx。
解决方法:降级安装xlrd
D:\Python\Python37\Scripts>pip uninstall xlrd
Uninstalling xlrd-2.0.1:
Would remove:
d:\python\python37\lib\site-packages\xlrd-2.0.1.dist-info\*
d:\python\python37\lib\site-packages\xlrd\*
d:\python\python37\scripts\runxlrd.py
Proceed (y/n)? y
Successfully uninstalled xlrd-2.0.1
D:\Python\Python37\Scripts>pip install xlrd==1.2.0
Collecting xlrd==1.2.0
Downloading https://files.pythonhosted.org/packages/b0/16/63576a1a001752e34bf8ea62e367997530dc553b689356b9879339cf45a4/xlrd-1.2.0-py2.py3-none-any.whl (103kB)
|████████████████████████████████| 112kB 467kB/s
Installing collected packages: xlrd
Successfully installed xlrd-1.2.0
WARNING: You are using pip version 19.2.3, however version 21.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
D:\Python\Python37\Scripts>