执行此代码时,我收到以下错误:
import time
import sys
import Adafruit_MCP9808.MCP9808 as MCP9808
import json;
sensor = MCP9808.MCP9808()
错误:
Traceback (most recent call last):
File "/home/pi/sensor01.py", line 17, in <module>
sensor = MCP9808.MCP9808()`enter code here`
File "/home/pi/Adafruit_MCP9808/MCP9808.py", line 62, in __init__
import Adafruit_GPIO.I2C as I2C
File "/home/pi/Adafruit_GPIO/I2C.py", line 25, in <module>
import smbus
File "/home/pi/smbus/__init__.py", line 1, in <module>
from .smbus import ffi
File "/home/pi/smbus/smbus.py", line 94, in <module>
""", ext_package='smbus')
File "/home/pi/smbus/cffi/api.py", line 433, in verify
lib = self.verifier.load_library()
File "/home/pi/smbus/cffi/verifier.py", line 113, in load_library
self._compile_module()
File "/home/pi/smbus/cffi/verifier.py", line 210, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "/home/pi/smbus/cffi/ffiplatform.py", line 29, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose)
File "/home/pi/smbus/cffi/ffiplatform.py", line 62, in _build
raise VerificationError('%s: %s' % (e.__class__.__name__, e))
VerificationError: CompileError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
答案 0 :(得分:2)
原来是权限问题 - 尝试安装setup.py时。 这篇文章帮助我解决了这个问题: https://unix.stackexchange.com/questions/119358/create-file-in-folder-permission-denied