按照文档,我正在安装 spidev
pip3 install spidev
在 MacOS 11.4 上的 Python 3.7.3 中并出现以下错误:
Defaulting to user installation because normal site-packages is not writeable
Collecting spidev
Using cached spidev-3.5.tar.gz (10 kB)
Building wheels for collected packages: spidev
Building wheel for spidev (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/setup.py'"'"'; __file__='"'"'/private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-wheel-df05b117
cwd: /private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/
Complete output (12 lines):
running bdist_wheel
running build
running build_ext
building 'spidev' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
xcrun -sdk macosx clang -arch x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Headers -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c spidev_module.c -o build/temp.macosx-10.14-x86_64-3.7/spidev_module.o
spidev_module.c:33:10: fatal error: 'linux/spi/spidev.h' file not found
#include <linux/spi/spidev.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'xcrun' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for spidev
Running setup.py clean for spidev
Failed to build spidev
Installing collected packages: spidev
Running setup.py install for spidev ... error
ERROR: Command errored out with exit status 1:
command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/setup.py'"'"'; __file__='"'"'/private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-record-ivqzy7c8/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/wogsland/Library/Python/3.7/include/python3.7m/spidev
cwd: /private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/
Complete output (12 lines):
running install
running build
running build_ext
building 'spidev' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
xcrun -sdk macosx clang -arch x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Headers -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c spidev_module.c -o build/temp.macosx-10.14-x86_64-3.7/spidev_module.o
spidev_module.c:33:10: fatal error: 'linux/spi/spidev.h' file not found
#include <linux/spi/spidev.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'xcrun' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/setup.py'"'"'; __file__='"'"'/private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-install-u033u0oe/spidev_96f8104add874aca92e572d21798ca0a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tf/vd1f171x1cxcgc2sq0ttn_v00000gn/T/pip-record-ivqzy7c8/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/wogsland/Library/Python/3.7/include/python3.7m/spidev Check the logs for full command output.
我需要先安装 Python 外部的依赖项吗?