Python||报错:ImportError: Missing optional dependency ‘xlrd‘. Install xlrd >= 1.0.0 for Excel support
一、问题一1.1问题描述使用pandas.read_excel()函数读取2wdata1.xlsx文件里的数据,却报错ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.1.2解决方案打开Anacond
一、问题一
1.1问题描述
使用pandas.read_excel()函数读取2wdata1.xlsx文件里的数据,却报错ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
1.2解决方案
打开Anaconda Prompt,进入对应的虚拟环境,使用命令行pip install xlrd安装相应的安装包
二、问题二
2.1问题描述
在上边的报错解决后,再次运行代码,报出新的错误XLRDError: Excel xlsx file; not supported
OK,I'm fine(苦笑.jpg)
2.2解决方案
报错的原因是新版本的xlrd只支持xls文件,不支持xlsx文件,那就安装支持该文件的低版本库喽~~~
还是报错(苍天啊,放过我吧T_T)
算了,此处不留爷,自有留爷处。何必在一棵树上吊死,换个库试试(机智如我.jpg)
使用openpyxl代替xlrd,读取文件时记得指定引擎engine='openpyxl'
再次运行,不报错,nice§(* ̄▽ ̄*)§
更多推荐
所有评论(0)