You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:运行脚本时无法从easygui导入floatbox的问题

Fixing "ImportError: cannot import name 'floatbox' from 'easygui'"

Hey there, let's work through this error step by step. This issue almost always boils down to a version mismatch between the easygui library you have installed and the code that's trying to use floatbox—here's how to fix it:

  • Check your current easygui version
    First, run this command in CMD to see what version you're working with:

    pip show easygui
    

    The floatbox function was present in older versions of easygui but got removed or renamed in newer releases. If your version is 1.0 or later, that's likely the root problem.

  • Install a compatible older version
    If you specifically need the floatbox function, install a version that still includes it. Try this command:

    pip install easygui==0.98.3
    

    This is a stable version known to have floatbox included. If you get a "requirement already satisfied" error, add --force-reinstall to overwrite the current incompatible version:

    pip install --force-reinstall easygui==0.98.3
    
  • Verify your Python environment
    Sometimes the issue is that you're installing easygui into a different Python environment than the one you're running your script with. To ensure you're using the right pip for your current CMD session, run:

    python -m pip install easygui==0.98.3
    

    This guarantees the library is installed for the exact Python interpreter you're using to run your script.

  • Use an alternative if you want to keep the latest version
    If you prefer sticking to the newest easygui release, replace floatbox with enterbox and add manual validation for numeric input. For example:

    from easygui import enterbox
    
    user_input = enterbox("Enter a number:")
    try:
        float_value = float(user_input)
        # Your code using float_value here
    except ValueError:
        print("Please enter a valid numeric value.")
    

内容的提问来源于stack exchange,提问作者Dada Ben Kedher

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 08:19:20