在 anaconda mac 中安装 pygame 模块

Installing pygame module in anaconda mac

我在 mac 上安装了 Anaconda。它弄乱了我的 pygame 模块。

我尝试按照此 tutorial 并将 pip3 install pygame 替换为 conda install pygame。我试过 conda install pip 然后 pip install pygame 但我收到以下错误:

Collecting pygame
  Could not find any downloads that satisfy the requirement pygame
  Some externally hosted files were ignored as access to them may be unreliable (use --allow-external pygame to allow).
  No distributions at all found for pygame

(我从这个 thread 中得到的想法)

使用 "pip install pygame" 在我执行 "conda install pip" 之前工作,但是我的默认 python 现在是 anaconda 并且不再访问 pygame。使用 which pip 得到 /Users/jensdonlin/anaconda/bin/pip

有没有人有一些建议可以让 anaconda 的 python3 版本访问 pygame?

也许答案涉及 use --allow-external pygame to allow,但我不太确定如何使用它。

这里的问题是 pygame 开发人员还没有上传 pygame 到 PyPI。因此,要安装它,您必须下载它并 pip 安装下载的源,如您链接的教程中所述。您可以在 Anaconda Python 中执行此操作。注意在Anaconda中Python,即使是Python3,pip也只是调用了pip,而不是pip3

我已经尝试了 pip 的许多排列组合。问题是我没有指定我正在尝试的文件路径 pip install pygame。我现在已经按照上面给出的教程成功安装了 pygame 并使用:pip install /Users/YOURNAME/Downloads/pygame

在毫无乐趣地摆弄 macports 和自制软件 2 天之后,使用 Anaconda Python 2.7.10 mac 的说明 here 对我有用].在这里回应他们以防链接网站消失!

首先打开终端并输入这两行:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install sdl sdl_ttf sdl_image sdl_mixer portmidi

如果您没有安装 binstar,请输入:

conda install binstar

此时它可能会告诉您 'binstar' conda 包已重命名为 'anaconda-client' 并且您必须改为键入:

conda install anaconda-client

只要按照它告诉你的去做。最后,输入:

conda install -c https://conda.binstar.org/quasiben pygame

希望你已经完成了!