尝试导入Openpyxl时出现错误

时间:2020-01-17 17:32:15

标签: python openpyxl

尝试使用import openpyxl时出现回溯(最近一次通话最近)错误:

我仅有的一行代码是

'''

import openpyxl

'''

'Traceback (most recent call last):
  File "C:/Users/rwarke/PycharmProjects/Helloworld/HelloWorld.py", line 1, in <module>
    import openpyxl
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\__init__.py", line 6, in <module>
    from openpyxl.workbook import Workbook
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\workbook\__init__.py", line 4, in <module>
    from .workbook import Workbook
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\workbook\workbook.py", line 7, in <module>
    from openpyxl.worksheet.worksheet import Worksheet
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\worksheet\worksheet.py", line 24, in <module>
    from openpyxl.cell import Cell, MergedCell
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\cell\__init__.py", line 3, in <module>
    from .cell import Cell, WriteOnlyCell, MergedCell
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\cell\cell.py", line 27, in <module>
    from openpyxl.styles import numbers, is_date_format
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\styles\__init__.py", line 4, in <module>
    from .alignment import Alignment
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\styles\alignment.py", line 5, in <module>
    from openpyxl.descriptors import Bool, MinMax, Min, Alias, NoneSet
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\descriptors\__init__.py", line 3, in <module>
    from .base import *
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\descriptors\base.py", line 12, in <module>
    from openpyxl.utils.datetime import from_ISO8601
  File "C:\Users\rwarke\PycharmProjects\Helloworld\openpyxl\utils\datetime.py", line 12, in <module>
    from jdcal import (
ModuleNotFoundError: No module named 'jdcal'

有人可以让我知道我需要在这里做什么吗?安装是否有错误

谢谢

1 个答案:

答案 0 :(得分:0)

看来openpyxl取决于jdcal,因此安装'jdcal'可以解决问题

pip install jdcal