from openpyxl.styles import Style, Font ImportError: cannot import name Style

from openpyxl.styles import Style, Font ImportError: cannot import name Style

当 运行 一个 python 代码时,我遇到了以下错误:

sbassi-mbpro:FacebookEventScraper-master sbassi$ python facebook_event_scraper.py 
Traceback (most recent call last):
  File "facebook_event_scraper.py", line 13, in <module>
    from openpyxl.styles import Style, Font
ImportError: cannot import name Style

python -V
Python 2.7.10

查看 source code for openpyxl.styles, the __init__.py 文件未定义任何名称:Style

也许您正在寻找 NamedStyle

应该是:

>>> import openpyxl
>>> from openpyxl.styles import Font, NamedStyle 

Automate the Boring Stuff Edited materials