我尝试通过在终端输入pip install pygame
在我的macbook pro上安装pygame。它没有工作,只是给了我:
Collecting pygame
Using cached pygame-1.9.3-cp27-cp27m-macosx_10_9_intel.whl
Installing collected packages: pygame
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pygame'
我有点新的编程和使用终端的东西,所以我可能犯了一个巨大的愚蠢的错误,但如果你知道我做错了什么或我要做些什么来解决它,请告诉我。
答案 0 :(得分:0)
我认为您正在以无权写入包含Python库的系统文件夹的用户身份运行该命令。在Mac上不确定如何运行sudo命令。
答案 1 :(得分:0)
使用sudo pip install pygame
进行安装。权限的最后一行表示权限被拒绝,这意味着您没有当前用户的权限。 Sudo会暂时让你生根。