2014-08-28 100 views
0

我遵循教程(https://sites.google.com/site/programmersnotebook/remote-development-of-python-scripts-on-raspberry-pi-with-eclipse),我可以成功地從eclipse客戶端(Windows 7)連接到服務器(在這種情況下是樹莓派)。當我運行一個簡單的python像Eclipse遠程系統資源管理器和ImportError:沒有名爲RPi.GPIO的模塊

print 'hello' 

一切正常。然而,當我運行下面的

import RPi.GPIO as GPIO 

GPIO.setmode(GPIO.BCM) 

GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) 

GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP) 

def printFunction(channel): 

    print("Button 1 pressed!") 

    print("Note how the bouncetime affects the button press") 

GPIO.add_event_detect(23, GPIO.RISING, callback=printFunction, bouncetime=300) 

while True: 

    GPIO.wait_for_edge(24, GPIO.FALLING) 

    print("Button 2 Pressed") 

    GPIO.wait_for_edge(24, GPIO.RISING) 

    print("Button 2 Released") 

GPIO.cleanup() 

我得到以下

pydev debugger: starting (pid: 7744) 
Traceback (most recent call last): 
    File "C:\eclipse\plugins\org.python.pydev_3.7.0.201408261926\pysrc\pydevd.py", line 2086, in <module> 
debugger.run(setup['file'], None, None) 
    File "C:\eclipse\plugins\org.python.pydev_3.7.0.201408261926\pysrc\pydevd.py", line 1543, in run 
pydev_imports.execfile(file, globals, locals) # execute the script 
    File "C:\Users\francis.reed\workspace\RemoteSystemsTempFiles\10.137.10.110\home\francis\raspiproj\test.py", line 1, in <module> 
import RPi.GPIO as GPIO 
ImportError: No module named RPi.GPIO 

注:RPi.GPIO僅安裝在服務器(覆盆子PI),而不是Eclipse客戶端(Windows 7)中。

有沒有辦法運行腳本,並讓所有導入語句在服務器(rapsberry pi)上查找模塊而不是eclipse客戶端(windows 7)?

任何幫助表示讚賞!

+0

你是否設法解決這個問題? – Ahmed 2016-04-28 02:09:37

回答

0

我有這個工作......我想我有幾個問題。首先,我試圖錯誤地運行遠程調試會話。此鏈接更具體一些: http://pydev.org/manual_adv_remote_debugger.html

此外,我的主機IP地址已更改,所以這在pydevd.settrace()命令中不正確。

啓動遠程調試器,在代碼中添加斷點,然後在Eclipse的遠程Shell窗口中啓動腳本運行。

相關問題