我在Windows上 7(我完全承认我不明白权限模型。我的用户是管理员。当我尝试运行“python distribute_setup.py”时,出现“写入失败...权限被拒绝”错误,然后出现“错误:无法在安装目录中创建或删除文件”。在Windows 7上安装Python并分发给出了“写入失败...权限被拒绝”
我刚刚从python.org安装了Python 3.2.2 MSI安装程序。
我安装32位的Python,即使我在64位的Windows,因为我将有一些依赖需要它(pyglet,一个OpenGL库)。
我下载distribute_setup.py和运行“python distribute_setup.py”从命令行。
半路通过大量的无用文字的这种渗出物是一些隐藏的错误消息:
root: Generating grammar tables from E:\Program Files (x86)\Python3.2.2\Lib\lib2to3\PatternGrammar.txt
root: Writing grammar tables to E:\Program Files (x86)\Python3.2.2\Lib\lib2to3\PatternGrammar3.2.2.final.0.pickle
root: Writing failed:[Errno 13] Permission denied: 'E:\\Program Files (x86)\\Python3.2.2\\Lib\\lib2to3\\PatternGrammar3.2.2.final.0.pickle'
这三行重复约二十次,则:
Scanning installed packages
No setuptools distribution found
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: 'E:\\Program Files (x86)\\Python3.2.2\\Lib\\site-packages\\test-easy-install-5924.write-test'
目录“E: \ Program Files(x86)\ Python3.2.2 \ Lib“允许管理员”完全控制“。我的用户是管理员(并且选中的权限复选框都灰显 - 我无法关闭“完全控制”,即使我想也不能关闭任何其他权限。)
我推测添加了“完全控制” “用户”组以及“管理员”组。重新运行,我不再得到同样的错误,但它退出在相同的点,用:
Scanning installed packages
No setuptools distribution found
build\src\setuptools\command\easy_install.py:289: UserWarning: Unbuilt egg for distribute [unknown version] (c:\users\jhartley\appdata\local\temp\tmpr0dzkz\distribute-0.6.24\build\src)
self.local_index = Environment(self.shadow_path+sys.path)
warning: no files found matching 'Makefile' under directory 'docs'
warning: no files found matching 'indexsidebar.html' under directory 'docs'
error: E:\Program Files (x86)\Python3.2.2\Scripts: Access is denied
没有“E:\程序文件(x86)\ Python3.2.2 \脚本”目录。我创建一个。它由“管理员”拥有,并为管理员设置了“完全控制”。我注意到所有其他的Python文件和目录都归“SYSTEM”所有。再次运行提供了:
Scanning installed packages
No setuptools distribution found
build\src\setuptools\command\easy_install.py:289: UserWarning: Unbuilt egg for distribute [unknown version] (c:\users\jhartley\appdata\local\temp\tmp1kmbk6\distribute-0.6.24\build\src)
self.local_index = Environment(self.shadow_path+sys.path)
warning: no files found matching 'Makefile' under directory 'docs'
warning: no files found matching 'indexsidebar.html' under directory 'docs'
error: E:\Program Files (x86)\Python3.2.2\Scripts\easy_install-script.py: Permission denied
即使“脚本”目录具有“完全控制”授予管理员,我试着推测增加对用户组“完全控制”。重新运行会产生一些警告:
Scanning installed packages
No setuptools distribution found
build\src\setuptools\command\easy_install.py:289: UserWarning: Unbuilt egg for distribute [unknown version] (c:\users\jhartley\appdata\local\temp\tmp31bznf\distribute-0.6.24\build\src)
self.local_index = Environment(self.shadow_path+sys.path)
warning: no files found matching 'Makefile' under directory 'docs'
warning: no files found matching 'indexsidebar.html' under directory 'docs'
但似乎成功完成。
然而,然后运行“的easy_install virtualenv中”产生一个用户帐户控制对话框“是否要允许以下程序从一个不知名的出版商修改此计算机?”然后创建一个新的CMD窗口,该窗口闪烁并消失得太快而看不到,并且看起来不起作用:virtualenv尚未安装。
我想停止每次出现UAC对话框。这很烦人:“easy_install”是我信任的程序,每次运行它时都不需要确认。我可以找到的所有解决方案阻止UAC对话框出现,包括为可执行文件创建一个神奇的双击快捷键。我还没有发现任何命令行应用程序。
我还想停止easy_install在新的cmd窗口中启动。这使得看不到输出。此问题似乎与UAC对话框无关,因为全局关闭UAC意味着easy_install将在没有对话框的情况下运行,但仍会在新窗口中运行。
这是怎么回事?我究竟做错了什么?
您是否使用“以管理员身份运行”打开命令提示符? – jgritty
我不是。这似乎确定了它!万岁!多么尴尬。但我根本不承认 - 我的用户已经是*管理员。那么,“以管理员身份运行”行为究竟在做什么?这是否适用于我使用“未知发布者”安装的*每个*可执行文件?这并不意味着您必须以管理员身份运行每个控制台会话吗?无论如何,如果你添加一个答案,我会很乐意选择它,但如果你能解释这些事情,我会非常高兴。 –
我的妻子在Windows上有更多的开发经验,告诉我这是因为“Windows是f **** d”。我会敦促她将这个提交给stackoverflow,因为这似乎是一个可以接受的答案。 –