Can't execute setup.py (Error 5 - Access Denied)

别等时光非礼了梦想. 提交于 2019-12-25 02:29:59

问题


I ran into a problem creating a new project in Cocos2d-x 3.1.1 (or 3.0 - it happens at both versions).

When I'm running the build script in console (Windows 8 - console with admin privileges) an WindowsError pops up (check the image below).

http://i.imgur.com/Ixg4jEE.png

I can set up the COCOS_CONSOLE_ROOT manually, but it does not help with the Error 5. I tried setting the 777 priviligies an all cocos2d-x folder and subfolders, but it does not help.

Anybody had the same problem? Any solutions out there?


回答1:


On Windows you should not put manually installed programs and tools under C:\Program... (english: C:\Program Files) because that's a folder where only apps with a proper installer should go. Otherwise you will keep having permission issues. Apps are not allowed to write to that folder or any of its subfolders.

Since cocos2d-x isn't an app, it can't redirect its output to the proper AppplicationData folder as is mandated by the operating system. Not being able to write or modify the program folder's contents (except during installation) is a security feature in Windows that you can't (or shouldn't) bypass.

To fix this simply extract cocos2d-x in a folder that both you and apps have full read/write permission. Normally this would be in your Documents folder, but Desktop would also work and probably just any folder on a drive that you created, for instance C:\cocos2d-x.




回答2:


Due to this line:

_winreg.SetValueEx() ...

the actual problem looks like to be with registry access, rather than with file permissions.

Make sure you actually running console as an admin, by:

  • searching cmd in Windows search, or just creating a shortcut to it to desktop
  • right clicking to cmd.exe and choosing "Run as administrator"

Make sure you don't have registry access block in any way: like blocking in group policies, some "security optimization" software and viruses and antiviruses.

Make sure your python version is 2.x. Python 3.x is not supported.

Anyway, this 'setup.py' step is optional for using cocos2d-x and you can live without running it at all.



来源:https://stackoverflow.com/questions/24349217/cant-execute-setup-py-error-5-access-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!