简体   繁体   中英

How to setup remote debugging with Eclipse and PyDev

I have been working with a Python program in an Ubuntu 14.04 machine, however, I would like to be able to debug that Python program using Eclipse with the PyDev plugin, but since my Ubuntu machine doesn't have a UI I would like to be able to use my Windows machine, install Eclipse + PyDev on it, and use it to remotely debug the Python program from the Linux machine. Does anybody know how to set that up? I've seen there is something called remote debugger in the PyDev website ( http://www.pydev.org/manual_adv_remote_debugger.html ), so I'm guessing that is something I may be able to use to do what I want, but I don't get how it works or how to set it up. Can anybody help?

Here are the steps I took to be able to debug on Windows a program running on Linux.

  1. Open Debug Perspective in Eclipse(Windows), and start PyDev Server
  2. On linux run pip install pydevd
  3. Create a file on both windows and linux with code below
  4. Run the created script on Linux
  5. When code reaches pydevd.settrace statement it will connect to Eclipse running on Windows, and Eclipse will ask you where it can find the code, point it to where you've stored it on windows.
  6. Now you can step through the code, check variable values and etc...

     import os import pydevd pydevd.settrace("EclipseIDE_HOSTNAME", port=5678) a = 1 b = 2 c = a + b s = 'hello world' print(s)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM