当前位置: 首页 > news >正文

安装scikit-image==0.16.2报错

输入pip install scikit-image==0.16.2 报错如下:

Collecting scikit-image==0.16.2
  Using cached scikit-image-0.16.2.tar.gz (28.9 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      /tmp/pip-install-94361s0i/scikit-image_ed96910f4a29471eabab4acc826fc4be/setup.py:167: DeprecationWarning:

        `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
        of the deprecation of `distutils` itself. It will be removed for
        Python >= 3.12. For older Python versions it will remain present.
        It is recommended to use `setuptools < 60.0` for those Python versions.
        For more details, see:
          https://numpy.org/devdocs/reference/distutils_status_migration.html  


        from numpy.distutils.core import setup
      ·······

  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.

报错原因:

numpy.distutils 已被弃用,并且与当前环境中的 setuptools 版本不兼容。numpy.distutils 从 NumPy 1.23.0 开始被弃用,并且仅与 setuptools < 60.0 版本测试过。错误信息中提到 ModuleNotFoundError: No module named 'distutils.msvccompiler',这表明 numpy.distutils 试图使用 distutils 的一个不存在的模块。

解决方法:

 

此错误发生在尝试安装 `scikit-image==0.16.2` 时,原因是 `numpy.distutils` 已被弃用,并且与当前环境中的 `setuptools` 版本不兼容。`numpy.distutils` 从 NumPy 1.23.0 开始被弃用,并且仅与 `setuptools < 60.0` 版本测试过。错误信息中提到 `ModuleNotFoundError: No module named 'distutils.msvccompiler'`,这表明 `numpy.distutils` 试图使用 `distutils` 的一个不存在的模块。

要解决这个问题,你可以尝试以下步骤:

1. 降级 `setuptools`(我用的这个)

由于 `numpy.distutils` 与 `setuptools` 的新版本存在兼容性问题,你可以尝试将 `setuptools` 降级到 60.0 或更低版本:

pip install setuptools==59.8.0

然后再次尝试安装 `scikit-image==0.16.2`。

2. 使用 `pip` 的 `--no-deps` 选项

这个选项可以防止 `pip` 安装不需要的依赖项,有时候这可以绕过兼容性问题:

pip install --no-deps scikit-image==0.16.2

3. 使用 `conda` 安装

如果你使用的是 Anaconda 或 Miniconda,可以尝试使用 `conda` 来安装 `scikit-image`,因为 `conda` 通常会处理这些依赖关系:

conda install scikit-image=0.16.2

4. 手动安装依赖

如果问题仍然存在,你可以尝试手动安装 `scikit-image` 的依赖,然后再安装 `scikit-image`。这可能需要一些额外的步骤来确保所有依赖都正确安装。

 5. 更新 `pip`

确保你的 `pip` 是最新版本,因为旧版本的 `pip` 可能无法正确处理依赖关系:

pip install --upgrade pip

 6. 检查 Python 版本

确保你的 Python 版本与 `scikit-image` 和其他库兼容。有时候,库的特定版本可能只支持 Python 的特定版本。

 7. 环境变量

在安装过程中设置环境变量 `SETUPTOOLS_USE_DISTUTILS=stdlib`,以避免 `setuptools` 使用其自带的 `distutils` 副本:

SETUPTOOLS_USE_DISTUTILS=stdlib pip install scikit-image==0.16.2

http://www.dtcms.com/a/51705.html

相关文章:

  • Electron桌面应用开发:自定义菜单
  • 墨迹天气携手天润融通,用AI提升气象服务效率
  • Anolis服务器Arm64架构服务器配置(其他版本服务器解决方式思路一质)
  • 18.分布式任务调度
  • 进程控制 ─── linux第15课
  • 信号量(Semaphore)和文件锁(File Lock)
  • 第六章 流量特征分析-钓鱼邮件
  • RT-thread的MultiButton按键库的使用
  • Windows 系统下 Android 开发常用快捷键‌的整理
  • CentOS 7.9 上安装 Docker Compose
  • cmake、CMakeLists.txt、make、ninja
  • 【Flink银行反欺诈系统设计方案】5.反欺诈系统全生命周期设计
  • 深入浅出:UniApp 从入门到精通全指南
  • nacos和Eureka的学习
  • python量化交易——金融数据管理最佳实践——使用qteasy大批量自动拉取金融数据
  • 《谈判力》核心原则解读
  • “RStudio UI“快速指南
  • MiniMind用极低的成本训练属于自己的大模型
  • 前后分离文件上传案例,前端HTML,后端Net6开发的webapi(完整源代码)下载
  • 【 <一> 炼丹初探:JavaWeb 的起源与基础】之 Servlet 与 JSP 的协作:MVC 模式的雏形
  • 《ARM64体系结构编程与实践》学习笔记(五)
  • 电脑的系统版本是windows7的,下载pycharm的哪个版本比较好呢?
  • 组合逻辑和时序逻辑
  • 每日一题----------匿名内部类的注意事项
  • SpringCloud注册中心-eureka
  • 【深度学习CV】【图像分类】从CNN(卷积神经网络)、ResNet迁移学习到GPU高效训练优化【案例代码】详解
  • YOLOv8 自定义目标检测
  • 【原创】C# HttpClient 读取流数据的问题
  • Diffenc: Variational Diffusion With A Learned Encoder
  • 剑指 Offer II 059. 数据流的第 K 大数值