Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
196 views
in Technique[技术] by (71.8m points)

python - Error on python3 on windows subsystem for linux for fenics program

I'm just starting to use fenics in python3 on windows subsystem ubuntu, and when I open the first titurial file I got this error.

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

What's the problem here ?

I also have some problems to open windows files on ubunto terminal easily. Is there any simple method to do this ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Have you taken a look at the debug error? The error occurs in file: ft01_poisson.py, also with the error message: TclError: no display name and no $DISPLAY environment variable

It would seem you are calling another python script and you need to start debugging from there and not just the error message. The error message also suggests that you need to have the $DISPLAY environmental variable set. You can use the Python library: https://docs.python.org/3/library/os.html#os.environ to view your environmental variables.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...