首页 > 解决方案 > tmux:无法接受键盘输入

问题描述

我在 jupyter-notebook 中有以下简单代码。

x=input()
print('input:{}'.format(x))

我使用runipy在 tmux 会话中运行这个笔记本。但是,会话不会等待输入我的输入,而是继续打印“print('input:{}'.format(x))”。我用了

tmux send-keys attach -t mysession "Hello" ENTER

但这只会在会话中打印“Hello”,就好像它没有放在 x 中一样。有人可以帮忙吗?

谢谢!

标签: pythonjupyter-notebooktmux

解决方案


使用

jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb

我将笔记本转换为 python 脚本并在 tmux 会话中运行它。它按预期工作!感谢我的同事帮助回答这个问题!


推荐阅读