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

Windows10+Python3.8.5安装plotly遇_distutils_hack缺失错误求助

Fixing ModuleNotFoundError: No module named '_distutils_hack' When Installing Plotly on Python 3.8.5 (Windows 10)

Hey there, I’ve dealt with this exact _distutils_hack error before when working with older Python versions and setuptools. Let’s walk through some practical fixes to get Plotly installed successfully:

First, Let’s Recap Your Scenario

You’re on Windows 10 running Python 3.8.5, using an admin Command Prompt. When running pip3 install plotly, the install fails while trying to set up retrying-1.3.3 with this error:

ERROR: Command errored out with exit status 1:
 command: 'c:\programdata\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\student\AppData\Local\Temp\pip-install-2qndeluw\retrying_de785ef56b9d4150b577dd9f4437e271\setup.py'"'"'; __file__='"'"'C:\Users\student\AppData\Local\Temp\pip-install-2qndeluw\retrying_de785ef56b9d4150b577dd9f4437e271\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\student\AppData\Local\Temp\pip-pip-egg-info-3tjoj6d_'
 cwd: C:\Users\student\AppData\Local\Temp\pip-install-2qndeluw\retrying_de785ef56b9d4150b577dd9f4437e271\
Complete output (5 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\programdata\python38\lib\site-packages\setuptools\__init__.py", line 8, in <module>
    import _distutils_hack.override # noqa: F401
ModuleNotFoundError: No module named '_distutils_hack'

Solutions to Try

1. Downgrade Setuptools to a Version Compatible with Python 3.8

Newer setuptools versions dropped support for older Python releases like 3.8, which often causes this _distutils_hack mismatch. Here’s how to fix it:

  • Uninstall your current setuptools:
    pip3 uninstall -y setuptools
    
  • Install a compatible version (44.0.0 works great with Python 3.8):
    pip3 install setuptools==44.0.0
    
  • Now try installing Plotly again:
    pip3 install plotly
    

2. Install retrying Without Build Isolation

The build isolation process is sometimes the culprit here. Skip it for the retrying package first, then install Plotly:

  • Install retrying with the --no-build-isolation flag:
    pip3 install retrying>=1.3.3 --no-build-isolation
    
  • Once that’s done, install Plotly normally:
    pip3 install plotly
    

3. Upgrade Pip to the Latest Supported Version

Outdated pip can cause dependency resolution issues. Update it first:

python -m pip install --upgrade pip

Then retry the Plotly install.

4. Repair Your Python 3.8 Installation

Sometimes the built-in distutils module gets corrupted or wasn’t installed correctly:

  1. Locate your Python 3.8.5 installer (download it again from python.org if you don’t have it).
  2. Run the installer and select Modify.
  3. Ensure the distutils component is checked (it should be under "Optional Features").
  4. Click Next and follow the prompts to complete the repair.
  5. After repair, try installing Plotly again.

内容的提问来源于stack exchange,提问作者blizzardus

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 08:19:34