1

我正在尝试使用 tkcalendar 制作日期选择器,但每次我尝试运行它时,它总是向我显示此错误

Traceback (most recent call last):
  File "C:\Python\Django\UJT\test.py", line 1, in <module>
    from tkcalendar import *
  File "C:\Python\venv\lib\site-packages\tkcalendar\__init__.py", line 26, in <module>
    from tkcalendar.dateentry import DateEntry
  File "C:\Python\venv\lib\site-packages\tkcalendar\dateentry.py", line 35, in <module>
    from tkcalendar.calendar_ import Calendar
  File "C:\Python\venv\lib\site-packages\tkcalendar\calendar_.py", line 35, in <module>
    from babel import default_locale
  File "C:\Python\venv\lib\site-packages\babel\__init__.py", line 29, in <module>
    from babel.core import *
  File "C:\Python\venv\lib\site-packages\babel\core.py", line 19, in <module>
    from babel import localedata
  File "C:\Python\venv\lib\site-packages\babel\localedata.py", line 26, in <module>
    from UserDict import DictMixin
ModuleNotFoundError: No module named 'UserDict'

Process finished with exit code 1

我已经安装了 tkcalendar 并更新了我的 pip,但我仍然收到错误消息。

这是我的代码

from tkcalendar import *
from tkinter import *

root = Tk()
cal = Calendar(root, width=12, year=2019, month=6, day=22,
bg='white', fg='black', borderwidth=2)
cal.pack(padx=10, pady=10)
root.mainloop()

请帮助我,谢谢

4

0 回答 0