请参阅我的代码如下:
import pandas
df = pandas.read_excel('cat.xlsx')
在运行该命令之后,它会给我以下错误:
Traceback (most recent call last):
File "d:\OneDrive\桌面\practice.py", line 4, in
df = pandas.read_excel('cat.xlsx')
File "D:\python\lib\site-packages\pandas\util\_decorators.py", line 296, in wrapper
return func(*args, **kwargs)
File "D:\python\lib\site-packages\pandas\io\excel\_base.py", line 304, in read_excel
io = ExcelFile(io, engine=engine)
File "D:\python\lib\site-packages\pandas\io\excel\_base.py", line 867, in __init__
self._reader = self._engines[engine](self._io)
File "D:\python\lib\site-packages\pandas\io\excel\_xlrd.py", line 22, in __init__
super().__init__(filepath_or_buffer)
File "D:\python\lib\site-packages\pandas\io\excel\_base.py", line 353, in __init__
self.book = self.load_workbook(filepath_or_buffer)
File "D:\python\lib\site-packages\pandas\io\excel\_xlrd.py", line 37, in load_workbook
return open_workbook(filepath_or_buffer)
File "D:\python\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
我尝试用 pip 命令卸载和重新安装 Pandas 。错误仍然存在。我已经安装了 xlrd 2.0.1和 Pandas 1.1.5。