我在這裏嘗試了本教程: http://www.instructables.com/id/Orange-Pi-One-Python-GPIO-basic/?ALLSTEPS蟒蛇 - 編譯錯誤 - 無法導入名稱「GPIO」
每當我執行我的.py文件,我得到錯誤「無法導入名稱‘GPIO’」
這這裏是我別的都安裝後使用的代碼,在嘖嘖稱:
#import the library
from pyA20.gpio import gpio
from pyA20.gpio import port
from time import sleep
#initialize the gpio module
gpio.init()
#setup the port (same as raspberry pi's gpio.setup() function)
gpio.setcfg(port.PA7, gpio.OUTPUT)
#now we do something (light up the LED)
gpio.output(port.PA7, gpio.HIGH)
#turn off the LED after 2 seconds
sleep(2)
gpio.output(port.PA7, gpio.LOW)
我很新的這一切,所以請多多包涵。 非常感謝。
完整回溯是*始終*漂亮 –
的可能的複製[ImportError:無法導入名稱X](http://stackoverflow.com/questions/9252543/importerror-cannot-import-name-x) – user2728397
您是否從教程庫中運行'setup.py'? –