OSX的Docker X11问题-$ DISPLAY

时间:2018-07-09 15:46:21

标签: python macos docker x11 xquartz

我正在运行OSX Sierra,并试图为模型运行4个模拟和一个图形。它使用应该在X11窗口中返回图形结果的Docker。
但是,我进行了大量研究,发现以下建议无法单独发挥作用: -检查$ DISPLAY,以确保其为空白或清除 -重新安装XQuartz -更改XQuartz安全设置以获取网络权限 -修改ifconfig

下面是当前输出:

INFO simconf数据:time_sim = 4绘图== 1

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************

INFO       Iteration 0 from 4
INFO       Iteration 1 from 4
INFO       Iteration 2 from 4
INFO       Iteration 3 from 4
INFO       Plotting
Traceback (most recent call last):
  File "main.py", line 27, in <module>
    main()
  File "main.py", line 23, in main
    simulator_1.simulate()
  File "/app/src/algorithms/Envio-Algorithm-Tools/mpc_casadi/dmpc/../mpc_sim_tools_casadi/simulator_file.py", line 162, in simulate
    mpc_sim_tools.plot(self.dmpc_sim_data.data_list[index_mpc], fig_settings)
  File "/app/src/algorithms/Envio-Algorithm-Tools/mpc_casadi/dmpc/../mpc_sim_tools_casadi/mpc_sim_tools.py", line 8, in plot
    fig = mpcplot(mpc_data.x.T, mpc_data.u.T, mpc_data.d.T, mpc_data.tplot, fig_dict=fig_settings)
  File "/app/src/algorithms/Envio-Algorithm-Tools/mpc_casadi/dmpc/../mpc_sim_tools_casadi/mpc_sim_tools.py", line 43, in mpcplot
    fig = plt.figure()
  File "/usr/local/lib/python3.5/site-packages/matplotlib/pyplot.py", line 548, in figure
    **kwargs)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/backends/_backend_tk.py", line 1044, in new_figure_manager_given_figure
    window = Tk.Tk(className="matplotlib")
  File "/usr/local/lib/python3.5/tkinter/__init__.py", line 1876, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display "127.0.0.1:0.0"

The key issue appears to be in here: 
_tkinter.TclError: couldn't connect to display "127.0.0.1:0.0"

这是我之前运行的相关命令:

export DISPLAY = 127.0.0.1:0.0

docker create -it -e DISPLAY = $ DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --name算法工具-3 python-algorithm-tools-3

感谢所有帮助!

0 个答案:

没有答案