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

在Spyder中安装pandas_profiling失败,求可行安装方案

如何在Spyder中成功安装pandas_profiling?

仅使用Spyder IDE,尝试了以下几种方式安装pandas_profiling均失败:

  • pip install pandas-profiling
  • pip install pandas_profiling==2.5.0
  • pip install https://github.com/ydataai/pandas-profiling/archive/master.zip
  • 运行pandas_profiling_master中的setup.py

安装过程中报错,核心问题是生成包元数据时失败,原因是找不到htmlmin模块,具体错误详情如下:

Collecting pandas-profiling
  Using cached pandas_profiling-3.2.0-py2.py3-none-any.whl (262 kB)
Requirement already satisfied: jinja2>=2.11.1 in c:\users\asus\appdata\local\programs\spyder\pkgs (from pandas-profiling) (3.1.2)
Collecting tqdm>=4.48.2
  Using cached tqdm-4.64.0-py2.py3-none-any.whl (78 kB)
Requirement already satisfied: markupsafe~=2.1.1 in c:\users\asus\appdata\local\programs\spyder\pkgs (from pandas-profiling) (2.1.1)
Collecting visions[type_image_path]==0.7.4
  Using cached visions-0.7.4-py3-none-any.whl (102 kB)
Collecting htmlmin>=0.1.12
  Using cached htmlmin-0.1.12.tar.gz (19 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
  error: subprocess-exited-with-error
  
  python setup.py egg_info did not run successfully.
  exit code: 1
  
  [6 lines of output]
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\Asus\AppData\Local\Temp\pip-install-kxfhoo5r\htmlmin_c9d69781ba1c4bc19ec6208da42060a8\setup.py", line 4, in <module>
      from htmlmin import __version__
  ModuleNotFoundError: No module named 'htmlmin'
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details

解决方案

  1. 先安装兼容版本的htmlmin
    htmlmin 0.1.12的setup.py存在引用自身模块的问题,导致无法正常生成元数据。先安装修复该问题的版本:
pip install htmlmin==0.1.13
  1. 升级pip和setuptools(可选,但推荐)
    旧版本的包管理工具可能引发兼容性问题,执行以下命令升级:
pip install --upgrade pip setuptools
  1. 重新安装pandas_profiling
    完成上述步骤后,执行你需要的安装命令,例如:
pip install pandas-profiling

或者指定版本:

pip install pandas_profiling==2.5.0
  1. 验证安装
    在Spyder的IPython控制台中输入以下代码,若没有报错则安装成功:
import pandas_profiling

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 19:18:20