python - Gtk-WARNING **: cannot open display: -


i using data science toolbox running ubuntu 14.04 through vagrant in windows. installed opencv , tried simple python code.

import cv2 import numpy np  import matplotlib.pyplot plt   img = cv2.imread('image1.jpg' , cv2.imread_grayscale)  cv2.imshow('image' , img) cv2.waitkey(0) cv2.destroyallwindows() 

when run code error -

(image:1267): gtk-warning **: cannot open display: 

i have searched on internet not able find solution working me.

i have tried -

export display=:0.0 export display=:0 

and many more. have tried xhost +localhost gives error

xhost:  unable open display "" 

anyone know way solve problem.

you can forward display host, in vagrantfile, add following lines

  config.ssh.forward_agent = true   config.ssh.forward_x11 = true 

you need x-server running on windows machine (i use quartz on mac, need equivalent windows, xming) , when vagrant up boot vm, when run x-program pop-up on host.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -