Python tmux 会话中的绘图未显示
Python plot in tmux session not showing
在本地 machine (mac) 上使用 tmux 并执行 plt.show()
时,window 不会显示。但是代码可以运行,可以保存一个图。同时,可以在同一会话中打开 x-window。
我已经在 iterm2 和本机终端上测试过 mac。它给了我同样的行为。我们是否需要一些额外的配置才能在 tmux 上显示绘图?
这是因为我的 PATH 由于 https://superuser.com/questions/544989/does-tmux-sort-the-path-variable
中给出的原因而被弄乱了
它在 /usr/bin/python
中选择了旧的 python2.7 因为 tmux 调用了 /etc/profile
并在我的 shell PATH 前面添加了系统 bin。
要修复它,这个技巧对我有用
if [ -f /etc/profile ]; then
PATH=""
source /etc/profile
fi
在本地 machine (mac) 上使用 tmux 并执行 plt.show()
时,window 不会显示。但是代码可以运行,可以保存一个图。同时,可以在同一会话中打开 x-window。
我已经在 iterm2 和本机终端上测试过 mac。它给了我同样的行为。我们是否需要一些额外的配置才能在 tmux 上显示绘图?
这是因为我的 PATH 由于 https://superuser.com/questions/544989/does-tmux-sort-the-path-variable
中给出的原因而被弄乱了它在 /usr/bin/python
中选择了旧的 python2.7 因为 tmux 调用了 /etc/profile
并在我的 shell PATH 前面添加了系统 bin。
要修复它,这个技巧对我有用
if [ -f /etc/profile ]; then
PATH=""
source /etc/profile
fi