Python OSError: [Errno 13] 更新 setuptools 时权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22121569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 00:17:15  来源:igfitidea点击:

OSError: [Errno 13] Permission denied when updating setuptools

pythonhomebrewsetuptools

提问by davzaman

I'm trying to update setuptools using homebrew but I keep getting an error that says:

我正在尝试使用自制软件更新 setuptools,但我不断收到错误消息:

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/setuptools-1.1.3-py2.7.egg'

How do I allow my computer to make changes to that file so I can update setuptools?

如何允许我的计算机更改该文件以便我可以更新 setuptools?

采纳答案by davzaman

I figured out how to fix it! I looked up the name of that file setuptools-0.6c11-py2.7.eggand I found a python page on itthat says

我想出了如何解决它!我查找了该文件的名称,setuptools-0.6c11-py2.7.egg在其上找到了一个 python页面,上面写着

NOTE: Regardless of what sort of Python you're using, if you've previously installed older versions of setuptools, please delete all setuptools*.egg and setuptools.pth files from your system's site-packages directory (and any other sys.path directories) FIRST.

注意:无论您使用哪种 Python,如果您以前安装过旧版本的 setuptools,请从系统的站点包目录(以及任何其他 sys.path)中删除所有 setuptools*.egg 和 setuptools.pth 文件目录)首先。

So I deleted setuptools-0.6c11-py2.7.eggand setuptools.pthin /Library/Python/2.7/site-packages/then I went into terminal and typed in pip install --upgrade setuptoolsand it worked!

所以我删除setuptools-0.6c11-py2.7.egg,并setuptools.pth/Library/Python/2.7/site-packages/随后我走进终端,并在输入pip install --upgrade setuptools和它的工作!

回答by A.J. Uppal

Open Finder and select Go - Go To Folder. Then hit Command-I, and at the bottom under Sharing and Permissions, add yourself with Read and Write Access. This should solve it.

打开 Finder 并选择前往 - 前往文件夹。然后点击 Command-I,在底部的共享和权限下,为自己添加读写访问权限。这应该解决它。