Solve the problem that ordinary users cannot find the command using sudo

sudo bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/face_mesh:face_mesh_cpu

        Appear:

sudo: bazel:找不到命令

        Use whereis to find the absolute path of bazel:

whereis bazel

        or

which bazel

        Appear:

bazel: /usr/local/lib/bazel /home/zyy/bin/bazel

        Execute the command using an absolute path:

sudo /usr/local/lib/bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/face_mesh:face_mesh_cpu

        The command still cannot be found. Use the following command to succeed.

sudo /home/zyy/bin/bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/face_mesh:face_mesh_cpu

        The default sudo configuration file only specifies three command locations, as follows:

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

        You can use soft connections:

ln -s /home/zyy/bin/bazel /usr/bin/bazel

        Can be used directly:

sudo bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/face_mesh:face_mesh_cpu

Guess you like

Origin blog.csdn.net/qq_31112205/article/details/126401095