spyder怎么编python,Spyder:如何在本地编辑python脚本并在远程内核上执行它?

i am using Spyder 2.3.1 under Windows 7 and have a running iPython 2.3 Kernel on a Rasperry Pi RASPBIAN Linux OS.

I can connect to an external kernel, using a .json file and this tutorial:

Remote ipython console

But what now? If I "run" a script (F5), then the kernel tries to exectue the script like:

%run "C:\test.py"

ERROR: File u'C:\\test.py' not found.

This comes back with an error, ofc, because the script lays on my machine under c: and not on the remote machine/raspberry pi. How to I tell Spyder to somehow copy first the script to the remote machine and execute it there?

If I check the "this is a remote kernel" checkbox, I cannot connect to the existing kernel anymore. What does that box mean? Will it copy the script via SSH to the remote machine before execution?

If I enter the SSH login information, I get an "It seems the kernel died unexpectedly" error.

解决方案

The tutorial that you mention is a little bit our of date as Spyder now has the ability to connect to remote kernels.

The "This is a remote kernel" checkbox, when checked, enables the portion of the dialog where you can enter your ssh connection credentials.

(You should need this unless you have manually opened the required ssh tunnels to forward the process ports of your remote kernel... )

Besides, the ipython connection info (the json file) must correspond to the remote kernel, running on your raspberry pi.

Finally, there is no means at this time to copy the script lying on your local pc when you hit run. The preferred method would actually be the reverse: mount your raspberry pi's filesystem using a tool like sshfs and edit them in place. The plan is to implement an sftp client in Spyder so that it will not be required and you will be able to explore the remote filesystem from Spyder's file explorer.

To summarize:

1) assuming that you are logged in your raspberry pi, launch a local IPython kernel with

ipython kernel. It should give you the name of your json file to use, which you should copy to your local pc.

2) in spyder on your local pc, connect to a remote kernel with that json file and your ssh credentials

I know that it is cumbersome, but it is a first step..

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值