我遇到了一个问题,即尝试在导入 matplotlib 的情况下分离远程、活动的 IPython 会话(通过 Tmux(,然后注销 SSH 挂起。我必须使用 Crtl-C 来终止该过程。当我通过 SSH 重新进入计算机时,tmux 进程消失了。
示例 IPython:
~$ ssh-desk # ssh into remote machine
~$ tmux
~$ ipython
In [1]: import matplotlib.pyplot as plt
Crtl-b Crtl-b d
[detached (from session 0)]
~$ tmux ls
0: 1 windows (created Wed May 2 16:52:58 2018) [78x38]
~$ exit
logout
(process hangs here)
Ctrl-c
~$ ssh-desk
~$ tmux ls
no server running on /tmp/tmux-1000/default
我确实收到过一次关于 X11 会话被终止的错误。我认为这是因为我正在使用 ssh -Y 将 X11 转发为图形。
The X11 connection broke (error 1). Did the X11 server die?
有没有办法在IPython/Python中运行matplotlib并分离tmux会话并成功注销?
我在Linux Mint 18.3(本地和远程机器(,IPython 6.3.1
更新 我已经用谷歌搜索了使用 X11 转发分离 tmux 会话的所有潜在解决方案,但无法让它工作,包括将一些 DISPLAY 代码放入 .bashrc 文件中。我也尝试使用 xpra,但出现错误,找不到模块 rencode。
您始终可以回退到 ssh 转义序列:
sequence | description
-------- | -----------
~. | terminate connection (and any multiplexed sessions)
~B | send a BREAK to the remote system
~C | open a command line
~R | request rekey
~V/v | decrease/increase verbosity (LogLevel)
~^Z | suspend ssh
~# | list forwarded connections
~& | background ssh (when waiting for connections to terminate)
~? | this message
~~ | send the escape character by typing it twice
一旦您进入tmux
,如果您只想终止 ssh 连接,请键入例如:
~.
然后你可以再次ssh到服务器并执行以下操作:tmux attach