我想在Amazon EC2(Linux AMI)上使用iPython。我已经安装了Anaconda并启动了iPython来测试我已经创建的一些脚本。现在我只对在终端上运行它感兴趣(不作为笔记本)。
在我的代码开始时,我总是这样做:
import json
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
但是,我尝试从文本编辑器中使用CTRL+C,然后在终端中使用%paste,得到错误:
TclError: no display name and no $DISPLAY environment variable
如果我按照这个建议尝试ssh-X name@host No display name and no $DISPLAY environment variable using tkinter through ssh,我会得到:
/opt/X11/bin/xauth: file /Users/adrianp/.Xauthority does not exist
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
X11 forwarding request failed on channel 0
为了解决这个问题,我尝试了https://superuser.com/questions/249045/x11-forwarding-from-amazon-ec2-ami,但仍然收到一个警告:
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
同样的错误:
TclError: no display name and no $DISPLAY environment variable
根据这个建议Generating a PNG with matplotlib when DISPLAY is undefined(这似乎无关紧要,但我已经尝试了一切)我做到了:
import matplotlib
matplotlib.use('Agg')
在导入其他内容之前仍然会出现相同的错误。
对如何解决这个问题有什么想法吗?我真的很想使用粘贴魔法函数来输入函数等
这更多的是linux/X11问题,而不是python问题。另外,这个过程可能会有点过火——你最好在本地运行ipython或者启动一个web笔记本。
无论如何,你应该:
然后您应该能够启动ipython并使用%paste。
相关问题 更多 >
编程相关推荐