有没有可能让eclipse PyDev使用远程Python解释器?
我想这样做,因为我要连接的Linux服务器有几个优化求解器(CPLEX、GUROBI等)正在运行,而我的脚本需要用到它们。
目前我在本地使用eclipse编写脚本,然后将所有文件复制到远程机器上,使用ssh登录并在那里执行脚本"python script.py"。 相反,我希望点击"运行"按钮,并在我的eclipse IDE中执行所有内容。
谢谢
有没有可能让eclipse PyDev使用远程Python解释器?
我想这样做,因为我要连接的Linux服务器有几个优化求解器(CPLEX、GUROBI等)正在运行,而我的脚本需要用到它们。
目前我在本地使用eclipse编写脚本,然后将所有文件复制到远程机器上,使用ssh登录并在那里执行脚本"python script.py"。 相反,我希望点击"运行"按钮,并在我的eclipse IDE中执行所有内容。
谢谢
很遗憾,否定的答案。您可以通过远程系统资源管理器(RSE)远程连接到Linux服务器,但无法将其用作远程解释器。我使用的是Pycharm。您可以使用免费的社区版或专业版,需要付费购买。它不是非常昂贵,而且一直以来都运行得很好。
chmod +x runremote.sh
)fp="$1" # Local path to the script we want to run--for now,
# this is the only command I pass in from Eclipse, but you could add others if so inclined.
# My home directory is a little different on my local machine than on the remote,
# but otherwise things are in the same place. Adjust as needed.
fp=`python -c "print '$fp'.replace('/home/tsbertalan', '/home/oakridge/bertalan')"`
# Run the synchronization. I use Unison, but you could use something else,
# like two calls to rsync, or a series of scp commands.
reposync >/dev/null # The redirection assumes your sync command will print errors properly on stderr.
cd='cd '`dirname $fp`
# I use a virtual environment on the remote server, since I don't have root access to install
# packages globally. But this could be any set-up command you want to run on the remote.
# A good alternative would be `source $HOME/.profile` or `~/.bashrc`.
act='source /home/oakridge/bertalan/bin/activate'
fname="`basename $fp`"
cmd="$act ; $cd ; python $fname"
# Run the command remotely. The -X forwards X11 windows, so you can see your Matplotlib plots.
# One difficulty with this method is that you might not see all your output just as it is created.
ssh bertalan@remote.server.edu -X "$cmd"
sleep 1
# My synchronization script is bidirectional, but you could just use rsync with the arguments flipped.
reposync >/dev/null
#!/path/to/python
行。我不经常使用 Windows,所以无法提供太多帮助。