Mac安装pygame module
分类:
文章
•
2023-11-11 17:03:52
- 安装homedrew
打开终端, 执行命令: /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
- 安装pygame依赖: brew install hg sdl sdl_image sdl_ttf
- 安装pip - sudo easy_install pip
- pip install pygame (python 2.7, python3 需修改pip 到pip3)
- 但报如下错误:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/Library/Python/2.7/site-packages/pygame’
Consider using the --user
option or check the permissions.
所以用了 sudo pip install pygame命令 (root权限),但仍然报
Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted: ‘/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pygame’
- 后又执行了 pip install --user pyspider执行,在执行pip install pygame,安装成功