我刚开始在Windows子系统ubuntu上的python3中使用fenics,当我打开第一个file时,出现了此错误。
Solving linear variational problem. Traceback (most recent call last):
File "ft01_poisson.py", line 39, in <module> plot(u) File "/usr/lib
/python3/dist-packages/dolfin/common/plotting.py", line 438, in plot
return _plot_matplotlib(object, mesh, kwargs) File "/usr/lib/python3/dist-packages/dolfin/common/plotting.py", line 281, in _plot_matplotlib
ax = plt.gca() File "/usr/lib/python3/dist-packages/matplotlib
/pyplot.py", line 962, in gca return gcf().gca(**kwargs) File "/usr/lib
/python3/dist-packages/matplotlib/pyplot.py", line 592, in gcf return
figure() File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line
539, in figure **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 171, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig) File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 1049, in new_figure_manager_given_figure window = Tk.Tk(className="matplotlib") File "/usr/lib/python3.6/tkinter/__init__.py", line 2020, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable
这是什么问题?
我也有一些问题,无法轻松在ubunto终端上打开Windows文件。有没有简单的方法可以做到这一点?
答案 0 :(得分:0)
您是否看过调试错误?该错误发生在文件ft01_poisson.py
中,并带有错误消息:TclError: no display name and no $DISPLAY environment variable
似乎您正在调用另一个python脚本,您需要从那里开始调试,而不仅仅是错误消息。该错误消息还表明您需要设置$ DISPLAY环境变量。您可以使用Python库:https://docs.python.org/3/library/os.html#os.environ查看您的环境变量。