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

如何在Python中正确安装sklearn2pmml?安装报错求助

安装sklearn2pmml时持续出现metadata-generation-failed错误

我尝试使用多种pip命令安装sklearn2pmml,包括:

  • pip install --upgrade sklearn2pmml==0.83.0
  • pip install --upgrade sklearn2pmml
  • pip install sklearn2pmml
  • python3 -m pip install sklearn2pmml

但始终出现相同错误,详情如下:

pip install --upgrade sklearn2pmml==0.83.0
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting sklearn2pmml==0.83.0
  Using cached sklearn2pmml-0.83.0.tar.gz (6.3 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-4rirpdmx/sklearn2pmml_8f0847b696dd4b058e058b7e1e18cdda/setup.py", line 44, in <module>
          "sklearn-pandas>=0.0.10"
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/dist.py", line 474, in __init__
          for ep in metadata.entry_points(group='distutils.setup_keywords'):
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
          return SelectableGroups.load(eps).select(**params)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
          ordered = sorted(eps, key=by_group)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
          dist.entry_points for dist in unique(distributions())
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
          k = key(element)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 931, in _normalized_name
          return self._name_from_stem(stem) or super()._normalized_name
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 600, in _normalized_name
          return Prepared.normalize(self.name)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 855, in normalize
          return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/re.py", line 192, in sub
          return _compile(pattern, flags).sub(repl, string, count)
      TypeError: expected string or bytes-like object
      [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.

我尝试过以下操作,但问题依旧:

  • 安装该包的多个版本
  • 卸载重装不同版本的py4j

不清楚报错原因,请问有人遇到过类似问题吗?


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.14 01:05:20