python - 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 中一样。有人可以帮忙吗?
谢谢!
解决方案
使用
jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb
我将笔记本转换为 python 脚本并在 tmux 会话中运行它。它按预期工作!感谢我的同事帮助回答这个问题!
推荐阅读
- javascript - JSTree CSS 设置
- c# - 是否有一种内置方法可以有效地查找向量是否在向量数组中,如果是,它是什么#变量
- ruby-on-rails - 正则表达式和 Rails 验证
- graph - 如何使用 rust 和 petgraph 解决旅行商问题?
- python - BeautifulSoup .text 方法错误:ResultSet 对象没有属性“文本”
- reactjs - 如何在 Docker 上导入@react-pdf/renderer?
- html - 如何在顶部和底部的div内溢出图像,而不仅仅是在左右?
- r - 关于如何使用 ggraph 复制 igraph
- mysql - 在 SQL 中查找以 ___ 结尾的数据?
- powershell - 如何将文件夹中的文本文件转换为 CSV 文件