tensorflow 中运行 tf.summary.FileWriter()发生 /tensorboard; Permission denied error的解决办法

1.运行到如下代码时发生错误:

sw = tf.summary.FileWriter(TENSORBOARD_DIR)

2.报告的错误为:

/home/mengzhuo/PycharmProjects/dai20180321/venv1/bin/python /home/mengzhuo/PycharmProjects/dai20180321/keras_wacgan.py /home/mengzhuo/PycharmProjects/dai20180321/venv1/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from 'float' to 'np.floating' is deprecated. In future, it will be treated as 'np.float64 == np.dtype(float).type'. from ._conv import register_converters as _register_converters Using TensorFlow backend. Traceback (most recent call last): File "/home/mengzhuo/PycharmProjects/dai20180321/keras_wacgan.py", line 207, in sw = tf.summary.FileWriter(TENSORBOARD_DIR) File "/home/mengzhuo/PycharmProjects/dai20180321/venv1/lib/python3.5/site-packages/tensorflow/python/summary/writer/writer.py", line 352, in __init__ filename_suffix) File "/home/mengzhuo/PycharmProjects/dai20180321/venv1/lib/python3.5/site-packages/tensorflow/python/summary/writer/event_file_writer.py", line 67, in __init__ gfile.MakeDirs(self._logdir) File "/home/mengzhuo/PycharmProjects/dai20180321/venv1/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 374, in recursive_create_dir pywrap_tensorflow.RecursivelyCreateDir(compat.as_bytes(dirname), status) File "/home/mengzhuo/PycharmProjects/dai20180321/venv1/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__ c_api.TF_GetCode(self.status.status)) **tensorflow.python.framework.errors_impl.PermissionDeniedError: /tensorboard; Permission denied** Process finished with exit code 1

3.解决办法:

  • 把TENSORBOARD_DIR的值从相对路径改为绝对路径,比如我把:

TENSORBOARD_DIR = '/tensorboard/wgans/'

改为了:

TENSORBOARD_DIR = '/home/mengzhuo/PycharmProjects/dai20180321/tensorboard/wgans'

参考:

Tensorflow下使用 tf.summary.FileWriter(),提示 PermissionDeniedError

你可能感兴趣的:(tensorflow 中运行 tf.summary.FileWriter()发生 /tensorboard; Permission denied error的解决办法)