zhangtl 发表于 2023-12-21 13:09:46

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

本帖最后由 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
╰─>
      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
      

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

页: [1]
查看完整版本: 安装RPi.GPIO报错,尝试各种方法还是不行,求救各位大神