来自openpyxl.styles导入Style,Font ImportError:无法导入名称样式

时间:2016-09-21 23:27:17

标签: python openpyxl

在运行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

2 个答案:

答案 0 :(得分:2)

查看openpyxl.styles的source code__init__.py文件未定义任何名称:Style

也许您正在寻找NamedStyle

答案 1 :(得分:0)

应该是:

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

Automate the Boring Stuff Edited materials