权限被拒绝:"/tmp/.tensorboard-info/pid-31318.info"在运行 tensorboard 后尝试访问张量板文件



在运行了运行良好的代码后,我通过终端使用命令"tensorboard--logdir/work/tensorboard_logs/GLN"运行tensorboard。我得到了这个错误:PermissionError:[Error 13]权限被拒绝:'/tmp/.tensorboard info/pid-31452.inf'我运行命令whoami,实际上我是同一个用户。我在这里查过了https://github.com/tensorflow/models/issues/2641尝试了一些建议的解决方案,但仍然对我不起作用。PS:我正在学校的服务器上使用jupyter笔记本电脑(我自己的环境(,我的帐户

我遇到了同样的问题,并通过以下操作解决了它(从这里开始(:

export TMPDIR=/tmp/USER; 
mkdir -p $TMPDIR;

我也遇到了同样的问题。

出现此问题是因为您没有访问/tmp/.tensorboard info/目录的权限,该目录已经存在,但tensorboard希望访问它。

因此,

  1. 第一个解决方案是链接默认的临时路径环境变量($TMPDIR(,如上所述。

  2. 如果您不想更改$TMPDIR,第二个步骤是获取权限。如果您可以获得超级用户权限,那么只需授予777权限即可。

sudo chmod 777 /tmp/.tensorboard-info
  1. 如果您没有获得超级用户权限,请更改tensorboard代码。在tensorboard安装的目录中(可能是[PYTON_installed_DIR]/lib/python3.7/site-packages/tensorboard(

请编辑";。tensorboard信息";至";。tensorboard-info_custom";在manager.py 中的_get_info_dir((函数中

def _get_info_dir():
"""Get path to directory in which to store info files.
The directory returned by this function is "owned" by this module. If
the contents of the directory are modified other than via the public
functions of this module, subsequent behavior is undefined.
The directory will be created if it does not exist.
"""
# Change this part  .tensorboard-info->.tensorboard-info_custom
path = os.path.join(tempfile.gettempdir(), ".tensorboard-info_custom") 
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
else:
os.chmod(path, 0o777)
return path

最新更新