树莓派论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 961|回复: 0
收起左侧

[交流] 安装RPi.GPIO报错,尝试各种方法还是不行,求救各位大神

[复制链接]
发表于 2023-12-21 13:09:46 | 显示全部楼层 |阅读模式
本帖最后由 zhangtl 于 2023-12-21 15:13 编辑

本人使用的是win11系统,安装了thonny(版本4.1.4),python为3.10.11,安装路径:Python 3.10.11 (C:\Users\isztl\AppData\Local\Programs\Thonny\python.exe)
1、已经安装了Microsoft Vision Studio    2、已经安装了Microsoft Visual C++ 2015-2022
3、已经安装了Microsoft Visual C++ Compiler Package for python2.7
执行python -m pip install RPi.GPIO 或pip install --user rpi.gpio 或pip install rpi.gpio==0.6.1,均报错。
报错信息如下:
E:\07-树莓派学习\04-我的实验\01-亮灯>python -m pip install RPi.GPIO
Collecting RPi.GPIO
  Using cached RPi.GPIO-0.7.1.tar.gz (29 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: RPi.GPIO
  Building wheel for RPi.GPIO (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\RPi
      copying RPi\__init__.py -> build\lib.win-amd64-cpython-310\RPi
      creating build\lib.win-amd64-cpython-310\RPi\GPIO
      copying RPi\GPIO\__init__.py -> build\lib.win-amd64-cpython-310\RPi\GPIO
      running build_ext
      building 'RPi._GPIO' extension
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      creating build\temp.win-amd64-cpython-310\Release\source
      "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\isztl\AppData\Local\Programs\Thonny\include -IC:\Users\isztl\AppData\Local\Programs\Thonny\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" /Tcsource/c_gpio.c /Fobuild\temp.win-amd64-cpython-310\Release\source/c_gpio.obj
      c_gpio.c
      source/c_gpio.c(27): fatal error C1083: 无法打开包括文件: “sys/mman.h”: No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for RPi.GPIO
  Running setup.py clean for RPi.GPIO
Failed to build RPi.GPIO
ERROR: Could not build wheels for RPi.GPIO, which is required to install pyproject.toml-based projects

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|树莓派论坛 ( 粤ICP备15075382号-1  

GMT+8, 2024-11-22 15:14 , Processed in 1.125000 second(s), 25 queries , Gzip On.

Powered by Shumeipai.net! X3.2

© 2001-2015 树莓派论坛安全联盟

快速回复 返回顶部 返回列表