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

在Raspberry Pi 4 Model B(Python3.9.2)安装Pytorch与scikit-image遇阻求助

解决树莓派4B(Python3.9.2)上PyTorch与scikit-image的安装问题

PyTorch安装问题修复

1. Wheel不兼容错误

ERROR: torch-1.12.0a0+git67ece03-cp39-cp39-linux_aarch64.whl is not a supported wheel on this platform.

  • 先确认系统架构:执行uname -m,树莓派4B默认可能是armv7l(32位)或aarch64(64位),你下载的wheel是针对aarch64的,如果系统是32位,必然报错。
  • 对应架构选择稳定版预编译包安装:
    • 32位系统(armv7l):先更新pip,再执行适配命令:
      pip3 install --upgrade pip
      pip3 install torch==1.11.0 torchvision==0.12.0 --extra-index-url https://download.pytorch.org/whl/cpu
      
    • 64位系统(aarch64):确保系统是64位Raspberry Pi OS,直接用官方稳定版命令安装,避开非官方测试版wheel。

2. Git TLS连接中断错误

  • 临时关闭Git SSL验证(仅用于解决连接问题,不建议长期开启):
    git config --global http.sslVerify false
    
  • 换用国内PyPI源绕开Git克隆的网络问题:
    pip3 install torch torchvision -i https://pypi.tuna.tsinghua.edu.cn/simple
    

scikit-image安装问题修复

解决编译卡死、高温问题

树莓派CPU性能有限,源码编译scikit-image会耗尽系统资源,优先用预编译包安装:

  • 方法1:系统包管理器安装(适配性最优):
    sudo apt update
    sudo apt install python3-skimage
    
  • 方法2:PyPI预编译wheel安装,国内源加速:
    pip3 install scikit-image -i https://pypi.tuna.tsinghua.edu.cn/simple
    
  • 若必须源码编译(不推荐):先扩容swap分区缓解内存压力,再执行安装:
    sudo dphys-swapfile swapoff
    sudo sed -i 's/CONF_SWAPSIZE=100/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
    sudo dphys-swapfile swapon
    
    安装时尽量关闭其他后台程序,避免系统负载过高。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 17:01:07