hyztian 发表于 2021-10-26 10:30:31

easygui报AttributeError: module 'collections' has no attribute 'Sequence'错误

按照小甲鱼老师的easygui课件,打了例程,总是报的AttributeError: module 'collections' has no attribute 'Sequence',python我是用3.10版,搭配easygui用0.98.2版,我是python小白,请大神帮忙找一下问题,谢谢!
课件:
import easygui as t
import sys
while 1:
      t.msgbox("嗨,欢迎进入第一个界面小游戏^_^","tess")
      msg ="请问你希望在鱼C工作室学习到什么知识呢?"
      title = "小游戏互动"
      choices =["谈恋爱","编程","OOXX","琴棋书画"]
      choice = t.choicebox(msg, title, choices)
      # 注意,msgbox的参数是一个字符串
      # 如果用户选择Cancel,该函数返回None
      t.msgbox("你的选择是: " + str(choice), '结果')

      msg = "你希望重新开始小游戏吗?"
      title = "请选择"
         # 弹出一个Continue/Cancel对话框
      if t.ccbox(msg, title):
         pass            # 如果用户选择Continue
      else:
            sys.exit(0)   # 如果用户选择Cancel

报错内容:
   Traceback (most recent call last):
File "C:\Users\James.hong\Desktop\2.py", line 8, in <module>
    choice = t.choicebox(msg, title, choices)
File "D:\python3100\lib\site-packages\easygui\boxes\choice_box.py", line 38, in choicebox
    mb = ChoiceBox(msg, title, choices, preselect=preselect,
File "D:\python3100\lib\site-packages\easygui\boxes\choice_box.py", line 123, in __init__
    preselect_list = make_list_or_none(preselect, cast_type=int)
File "D:\python3100\lib\site-packages\easygui\boxes\choice_box.py", line 95, in make_list_or_none
    if not isinstance(obj, collections.Sequence):
AttributeError: module 'collections' has no attribute 'Sequence'

hrpzcf 发表于 2021-10-26 10:42:02

本帖最后由 hrpzcf 于 2021-10-26 10:47 编辑

装回旧版本python吧,3.7   3.83.9都可以,3.10估计已经把collections旧导入方法废弃了导致easygui导入它的时候出错。

hyztian 发表于 2021-10-26 12:44:39

hrpzcf 发表于 2021-10-26 10:42
装回旧版本python吧,3.7   3.83.9都可以,3.10估计已经把collections旧导入方法废弃了导致easygui导入它 ...

谢谢,装回旧版可以了。3.9试过也是可以的。

hrpzcf 发表于 2021-10-26 12:48:20

hyztian 发表于 2021-10-26 12:44
谢谢,装回旧版可以了。3.9试过也是可以的。

晚了一步,我自己修改了 EasyGUI 0.98.3 兼容 Python 3.10,需要的话就拿去吧。{:10_250:}
EasyGUI 0.98.3

hyztian 发表于 2021-10-26 13:57:49

hrpzcf 发表于 2021-10-26 12:48
晚了一步,我自己修改了 EasyGUI 0.98.3 兼容 Python 3.10,需要的话就拿去吧。
EasyGUI 0.98 ...

感谢感谢!

fendou501 发表于 2022-5-5 15:24:57

动不动就降python版本,有点麻烦啊,万一再安新模块,版本也高呢
页: [1]
查看完整版本: easygui报AttributeError: module 'collections' has no attribute 'Sequence'错误