Bling_B
Bling_B
2017-08-28 08:39

Ubuntu16.04系统plot出现permission denied

  • plot
  • ubuntu
  • permission denied
import numpy as np  
from keras.models import Sequential  
from keras.layers.core import Dense, Activation  
from keras.optimizers import SGD  
from keras.utils import np_utils      
from keras.utils.visualize_util import plot  
def run():  
    model = Sequential()  
    model.add(Dense(4, input_dim=2, init='uniform'))  
    model.add(Activation('relu'))  
    model.add(Dense(2, init='uniform'))  
    model.add(Activation('sigmoid'))  
    sgd = SGD(lr=0.05, decay=1e-6, momentum=0.9, nesterov=True)  
    model.compile(loss='binary_crossentropy', optimizer=sgd, metrics=['accuracy'])  
    plot(model, to_file='model.png')  
if __name__ == '__main__':  
    run()  

错误提示:
Traceback (most recent call last):
File "example2.py", line 21, in
run()

File "example2.py", line 18, in run
plot(model, to_file='model.png')

File "/home/c249/anaconda2/lib/python2.7/site-packages/keras/utils/visualize_util.py", line 64, in plot
dot.write_png(to_file)
File "/home/c249/anaconda2/lib/python2.7/site-packages/pydot.py", line 1811, in
lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog))
File "/home/c249/anaconda2/lib/python2.7/site-packages/pydot.py", line 1913, in write
dot_fd.write(self.create(prog, format))
File "/home/c249/anaconda2/lib/python2.7/site-packages/pydot.py", line 1992, in create
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
File "/home/c249/anaconda2/lib/python2.7/subprocess.py", line 390, in __init
_
errread, errwrite)
File "/home/c249/anaconda2/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答