接上一篇,解决了module ‘xlwt’ has no attribute 'workbook’的问题后又有了新的报错。以下为试错过程:
- 安装openpyxl包 ———安装后报错相同。方法来源
- 安装xlwings包——安装后报错相同。方法来源
from xlwings.xlwings import Workbook
报错 No module named ‘xlwings.xlwings’`from xlwings import Workbook
报错 cannot import name ‘Workbook’ from ‘xlwings’from openpyxl import workbook
报错 name ‘xlwt’ is not definedimport xlwt from openpyxl import workbook workbook = xlwt.workbook(encoding = 'utf-8')
报错module ‘xlwt’ has no attribute ‘workbook’ 方法来源- 热心的外国网友指出Note the capitalization of the name
- However,我试了大小写,依然name ‘xlwt’ is not defined。
到这里我忽然福如心至,发现是下面的代码引用了xlwt…所以,如果你用笔记本/小屏幕写代码,就不要把字号调大,不然报错的line都看不到。如果小屏,就老实去用jupyter吧。