Android Studio: 'sudo' 不是内部或外部命令,也不是可运行的程序或批处理文件
Android Studio: 'sudo' is not recognized as an internal or external command, operable program or batch file
作为我的 Android Studio "could not expand zip" 问题的 possible solution,我想 运行 从终端 window 在 [=24] 中执行此命令=]工作室:
sudo chmod -R 777 /your/project/path
但是,当我尝试时,我得到了这个错误:
'sudo' is not recognized as an internal or external command, operable
program or batch file.
如何解决? (我 运行正在 Android Studio 2.1.2 Windows 7。)
sudo
是一个 *nix 实用程序,不是您在 Windows 上可以找到的东西。同上 chmod
.
话虽如此,相关命令只是使用简单的位掩码调整项目文件夹的权限。来自 chmod
man page:
-R, --recursive change files and directories recursively
Numeric mode:
From one to four octal digits
Any omitted digits are assumed to be leading zeros.
The first digit = selects attributes for the set user ID (4) and set group ID (2) and save text image (1)S
The second digit = permissions for the user who owns the file: read (4), write (2), and execute (1)
The third digit = permissions for other users in the file's group: read (4), write (2), and execute (1)
The fourth digit = permissions for other users NOT in the file's group: read (4), write (2), and execute (1)
The octal (0-7) value is calculated by adding up the values for each digit
在您的命令中,缺少第一个数字,因此假定为 0。第二个、第三个和第四个是 7,这转化为 read/write/execute 目录所有者以及文件组中的任何其他人的访问权限,以及文件组中的任何其他 not。 -R 开关递归地将这些权限应用于 /your/project/path.
中的每个文件和文件夹
在 Windows 上,等效命令在资源管理器中。导航到 /your/project(不是 /your/project/path)并右键单击 /path。选择 Properties
将出现一个属性对话框。切换到该对话框中的 Security
选项卡。
从这里开始,有几种方法可以做到这一点。您可以简单地从 Group or user names
列表中单击您的用户帐户,点击列表底部的 Edit
按钮,然后给自己任何缺少的权限。
要进行更彻底的权限调整,包括您的 sudo
命令为您提供的递归,请选择 Advanced
而不是 Edit
。将出现一个新对话框 Advanced Security Settings for /path
。按 Change Permissions
。相同的对话框将重新出现,但 Change Permissions
将被 Add
按钮和 Edit
按钮替换。在底部,将有一个标记为 Replace all child object permissions with inheritable permissions from this object
的复选框。确保已选中 - 那是 -R。现在 select 从列表中选择您的用户名并选择 Edit
。检查每个复选框并点击 OK
。一直按 OK
退出对话框。运气好的话,这足以解决您的权限问题。
如果您想要更简单的修复,只需 运行 Android Studio 作为管理员,as suggested by the accepted answer in your question。与手动调整权限相比,这不太可能破坏事物,并且通常足以首先解决与权限相关的问题。
同样值得注意的是,接受的答案建议确保您对 android-sdk 和 Android Studio 目录具有写入权限。只有 sudo
答案建议调整 /your/project/path 的权限。为了得到答案,我将重点放在 Windows 等同于您询问的命令上;您可能想在 android-sdk 和 Android Studio 上进行类似的权限调整,而不仅仅是 /your/project/path.
最后,确保 android-sdk 没有安装在 %PROGRAMFILES% 中,因为 write access can be a problem there:
Click Start > All Programs > Accessories , right-click Notepad , and click Run as administrator . For protection against malware, Windows 7 doesn't allow normal processes to change files in the Program Files folder.
Android Studio 可以安全地安装在那里,但是 android-sdk 不能。
作为我的 Android Studio "could not expand zip" 问题的 possible solution,我想 运行 从终端 window 在 [=24] 中执行此命令=]工作室:
sudo chmod -R 777 /your/project/path
但是,当我尝试时,我得到了这个错误:
'sudo' is not recognized as an internal or external command, operable program or batch file.
如何解决? (我 运行正在 Android Studio 2.1.2 Windows 7。)
sudo
是一个 *nix 实用程序,不是您在 Windows 上可以找到的东西。同上 chmod
.
话虽如此,相关命令只是使用简单的位掩码调整项目文件夹的权限。来自 chmod
man page:
-R, --recursive change files and directories recursively
Numeric mode:From one to four octal digits
Any omitted digits are assumed to be leading zeros.The first digit = selects attributes for the set user ID (4) and set group ID (2) and save text image (1)S
The second digit = permissions for the user who owns the file: read (4), write (2), and execute (1)
The third digit = permissions for other users in the file's group: read (4), write (2), and execute (1)
The fourth digit = permissions for other users NOT in the file's group: read (4), write (2), and execute (1)The octal (0-7) value is calculated by adding up the values for each digit
在您的命令中,缺少第一个数字,因此假定为 0。第二个、第三个和第四个是 7,这转化为 read/write/execute 目录所有者以及文件组中的任何其他人的访问权限,以及文件组中的任何其他 not。 -R 开关递归地将这些权限应用于 /your/project/path.
中的每个文件和文件夹在 Windows 上,等效命令在资源管理器中。导航到 /your/project(不是 /your/project/path)并右键单击 /path。选择 Properties
将出现一个属性对话框。切换到该对话框中的 Security
选项卡。
从这里开始,有几种方法可以做到这一点。您可以简单地从 Group or user names
列表中单击您的用户帐户,点击列表底部的 Edit
按钮,然后给自己任何缺少的权限。
要进行更彻底的权限调整,包括您的 sudo
命令为您提供的递归,请选择 Advanced
而不是 Edit
。将出现一个新对话框 Advanced Security Settings for /path
。按 Change Permissions
。相同的对话框将重新出现,但 Change Permissions
将被 Add
按钮和 Edit
按钮替换。在底部,将有一个标记为 Replace all child object permissions with inheritable permissions from this object
的复选框。确保已选中 - 那是 -R。现在 select 从列表中选择您的用户名并选择 Edit
。检查每个复选框并点击 OK
。一直按 OK
退出对话框。运气好的话,这足以解决您的权限问题。
如果您想要更简单的修复,只需 运行 Android Studio 作为管理员,as suggested by the accepted answer in your question。与手动调整权限相比,这不太可能破坏事物,并且通常足以首先解决与权限相关的问题。
同样值得注意的是,接受的答案建议确保您对 android-sdk 和 Android Studio 目录具有写入权限。只有 sudo
答案建议调整 /your/project/path 的权限。为了得到答案,我将重点放在 Windows 等同于您询问的命令上;您可能想在 android-sdk 和 Android Studio 上进行类似的权限调整,而不仅仅是 /your/project/path.
最后,确保 android-sdk 没有安装在 %PROGRAMFILES% 中,因为 write access can be a problem there:
Click Start > All Programs > Accessories , right-click Notepad , and click Run as administrator . For protection against malware, Windows 7 doesn't allow normal processes to change files in the Program Files folder.
Android Studio 可以安全地安装在那里,但是 android-sdk 不能。