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

Python3.6+Anaconda环境下Matplotlib导入报错:AttributeError: module 'numbers' has no attribute 'Integral'

Fixing AttributeError: module 'numbers' has no attribute 'Integral' in Matplotlib (Python 3.6 + Anaconda)

Hey there! Let's break down how to fix this frustrating error you're hitting when importing matplotlib. This issue usually boils down to version compatibility or a simple naming conflict—here are the most common fixes:

1. Install a Matplotlib version compatible with Python 3.6

Python 3.6 is no longer supported by newer versions of matplotlib (versions >=3.4 dropped support for 3.6). You'll need to install a version that works with your Python release:

  • Open your Anaconda prompt and run:
    conda install matplotlib=3.3.4
    
    If you prefer using pip (though Anaconda environments work best with conda), use:
    pip install matplotlib==3.3.4
    

2. Check for a local file naming conflict

Sometimes, if you have a file named numbers.py in your working directory, it will override Python's built-in numbers module—this is a super common gotcha! To verify:

  • Run these lines in your Python shell:
    import numbers
    print(numbers.__file__)
    

If the output points to a file in your project folder (not the standard library directory like .../anaconda3/lib/python3.6/numbers.py), rename your local numbers.py to something else (like my_numbers.py) and delete any corresponding numbers.pyc file.

3. Create a fresh Anaconda environment (if the above don't work)

Corrupted environments can cause weird dependency issues. Let's make a clean environment tailored to your setup:

  • Run these commands in sequence:
    conda create -n py36_matplotlib python=3.6 matplotlib=3.3.4
    conda activate py36_matplotlib
    

Now try importing matplotlib again in this new environment—this should eliminate any lingering environment-specific bugs.

Give these steps a try, and let me know if you still run into issues!

内容的提问来源于stack exchange,提问作者O. Edward

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 06:30:34