提问者:小点点

由于权限被拒绝错误,无法使用toco(优化tf模型的编译器)


我遵循这个教程:https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2-tflite/index.html?index=../../index#3

我已经完成了前3个步骤,但现在当我尝试使用toco时,即使我是管理员,我也会收到此权限被拒绝错误。

使用sudo没有帮助。

(tutorial) pal-nat186-68-98:tensorflow-for-poets-2admin$ toco --help
/Users/admin/tutorial/lib/python3.6/importlib/_bootstrap.py:205: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
  return f(*args, **kwds)
/anaconda/lib/python3.6/site-packages/h5py/__init__.py:34: 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
Traceback (most recent call last):
  File "/Users/admin/tutorial/bin/toco", line 11, in <module>
    sys.exit(main())
  File "/Users/admin/tutorial/lib/python3.6/site-packages/tensorflow/contrib/lite/toco/python/toco_wrapper.py", line 35, in main
    os.execvp(binary, sys.argv)
  File "/Users/admin/tutorial/lib/python3.6/os.py", line 559, in execvp
    _execvpe(file, args)
  File "/Users/admin/tutorial/lib/python3.6/os.py", line 583, in _execvpe
    exec_func(file, *argrest)
PermissionError: [Errno 13] Permission denied

共2个答案

匿名用户

我遇到了同样的问题。你在Mac上吗?

无论如何,我发现在python2虚拟环境中安装<code>tf nightly</code>效果很好,而在python3虚拟环境中运行它会产生您所引用的相同错误。

匿名用户

我能够通过向toco添加可执行标志来在我的Mac上解决此问题。假设您位于 tensorflow-for-poets-2 文件夹内的终端中,这将完成这项工作:

chmod +x  tf/lib/python3.6/site-packages/tensorflow/aux-bin/toco