如何在 Eclipse 中为 Python 设置远程开发?(“远程”部分)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10224404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:03:22  来源:igfitidea点击:

How to set up remote development in Eclipse for Python? (the "remote" part)

pythoneclipseremote-debugging

提问by WoJ

I am new to Eclipse and I would like to set it up for remote development in Python. I use Eclipse on Win7, the sources being on a Linux machine (and expected to run from there).

我是 Eclipse 的新手,我想将其设置为在 Python 中进行远程开发。我在 Win7 上使用 Eclipse,源代码在 Linux 机器上(并希望从那里运行)。

I have used excellent guides to set up Eclipse for remote devand PyDEVand I now have:

我使用了优秀的指南来为远程开发PyDEV设置Eclipse,现在我有:

  • a working copy of Eclipse with PyDEV
  • access to my remote files via sftp from within Eclipse
  • 带有 PyDEV 的 Eclipse 工作副本
  • 在 Eclipse 中通过 sftp 访问我的远程文件

What I am missing now is the ability to actually run the files remotely, ie. I do not know the magic to make it so that when I execute the files from Eclipse they are run through /usr/bin/python on the Linux box with the output nicely managed by Eclipse (at least this is the dream part :)).

我现在缺少的是远程实际运行文件的能力,即。我不知道这样做的魔力,所以当我从 Eclipse 执行文件时,它们在 Linux 机器上通过 /usr/bin/python 运行,输出由 Eclipse 很好地管理(至少这是梦想的部分:)) .

Thanks!

谢谢!

采纳答案by Fabio Zadrozny

I must say I haven't tested this, but from what I know, you should be able to launch the file remotely as explained in: https://serverfault.com/questions/36419/using-ssh-to-remotely-start-a-processright?

我必须说我还没有测试过这个,但据我所知,您应该能够按照以下说明远程启动文件:https: //serverfault.com/questions/36419/using-ssh-to-remotely-start -a-过程对吗?

Now, provided you have that step working, you could either create a python script (i.e.: launch_my_project_remotely.py) and make it call that command line orcreate an external launcher (run > external tools).

现在,如果您执行了该步骤,您可以创建一个 python 脚本(即:launch_my_project_remotely.py)并使其调用该命令行创建一个外部启动器(运行 > 外部工具)。

Note that you can associate a keybinding to 'run last launched external tool' in window > preferences > general > keys.

请注意,您可以在窗口 > 首选项 > 常规 > 键中将键绑定与“运行上次启动的外部工具”相关联。

p.s.: note that you may also be interested in remote debugging in this case. For that see: http://pydev.org/manual_adv_remote_debugger.html

ps:请注意,在这种情况下,您可能还对远程调试感兴趣。参见:http: //pydev.org/manual_adv_remote_debugger.html

p.s.2.: personally, I don't really like a setup like this and prefer being totally remote (i.e.: http://nomachine.com/) or just doing all locally and having a http://jenkins-ci.org/server to make continuous integration of things I commit in different environments.

ps2。:就个人而言,我真的不喜欢这样的设置,更喜欢完全远程(即:http: //nomachine.com/)或只是在本地完成所有操作并拥有一个http://jenkins-ci.org/服务器对我在不同环境中提交的内容进行持续集成。