简体   繁体   English

pygame安装权限问题

[英]Permissions issue with pygame installation

I'm trying to download pygame on my Mac. 我正在尝试在Mac上下载pygame。 I had Python 3.6.0 installed and I went to the terminal (nothing else) and ran; 我已经安装了Python 3.6.0,然后去了终端(没有其他)并运行了;

pip install pygame

The end of the terminal said; 终端的末端说;

OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/
Versions/2.7/lib/python2.7/site-packages/pygame'

...But I tried it anyway in IDLE and it didn't work. ...但是我还是在IDLE中尝试了它,但是没有用。 I figured maybe this was for Python 2 so I installed Python 2.7.15 to see if that would work. 我想这可能是针对Python 2的,所以我安装了Python 2.7.15以查看是否可行。 Nothing. 没有。

Am I missing a step in installation or something? 我是否缺少安装步骤?

Note: I have tried Python 2 and it does not work. 注意:我已经尝试了Python 2,但是它不起作用。 I have tried installing using; 我尝试安装使用;

pip3 install pygame

...and I get the same error message at the end of the terminal output. ...并且在终端输出的末尾得到相同的错误消息。

You can either use pip3 install pygame or python3 -m pip install pygame to install pygame for python 3. 您可以使用pip3 install pygamepython3 -m pip install pygame来为python 3安装pygame。

The reason behind your error is because mac come with a python 2.7, so when you're using pip , it automatically think you're trying to install it to python2.7. 错误背后的原因是因为mac附带了python 2.7,所以当您使用pip ,它会自动认为您正在尝试将其安装到python2.7。 But you don't have permission to that site package folder. 但是您没有该站点包文件夹的权限。 Since you also downloaded python3, you can use pip by typing pip3 instead of pip . 由于您还下载了python3,因此可以通过键入pip3而不是pip来使用pip

If there's still a permission error, try running it as admin. 如果仍然存在权限错误,请尝试以管理员身份运行它。 For example sudo pip3 install pygame 例如sudo pip3 install pygame

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM