Python 尝试在 MAC 上使用 pip 时权限被拒绝?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50205646/
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
Permission denied with trying to use pip on MAC?
提问by Sam
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/beautifulsoup4-4.6.0.dist-info'Consider using the `--user` option or check the permissions.
The error above is the one I get when I try to use the pip command. All I need to do is pip install the requirements.txt to get my program to work. I have python 2.7.1 installed and placed my code where I am able to use python commands. I tried to change permissions by using this command:
上面的错误是我尝试使用 pip 命令时遇到的错误。我需要做的就是 pip install requirements.txt 让我的程序运行。我安装了 python 2.7.1 并将我的代码放在我可以使用 python 命令的地方。我尝试使用以下命令更改权限:
chmod -R 777
but it did not work. I have homebrew installed on my computer. I also tried to use a virtual environment using this link: http://sourabhbajaj.com/mac-setup/Python/virtualenv.htmlbut it gave me permission issues as well. Is there any suggestions to get rid of this permissions issue and run pip successfully? The sudo command below also doesn't work.
但它没有用。我的电脑上安装了自制软件。我还尝试使用以下链接使用虚拟环境:http: //sourabhbajaj.com/mac-setup/Python/virtualenv.html但它也给了我权限问题。是否有任何建议可以摆脱此权限问题并成功运行 pip?下面的 sudo 命令也不起作用。
sudo pip install -r requirements.txt
回答by Aidan Ross
回答by Beni
try using sudo pip install djangorestframework
for Mac. Worked for me.
尝试使用sudo pip install djangorestframework
Mac。为我工作。