在 anaconda mac 中安装 pygame 模块

2022-01-10 00:00:00 python pygame anaconda

问题描述

我的 Mac 上安装了 Anaconda.它弄乱了我的 pygame 模块.

I have Anaconda installed on my mac. And it has messed with my pygame module.

我尝试遵循此 教程 并替换 pip3 install pygameconda install pygame.我试过 conda install pip 然后 pip install pygame 但我得到以下错误:

I tried following this tutorial and replacing pip3 install pygame with conda install pygame. I have tried conda install pip and then pip install pygame yet i get the following error:

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

(我从这个线程得到的想法)

(ideas i got from this thread)

在我执行conda install pip"之前使用pip install pygame"就可以了,但是我的默认 python 现在是 anaconda 并且不再访问 pygame.使用 which pip 给出 /Users/jensdonlin/anaconda/bin/pip

Using the "pip install pygame" worked before i did the "conda install pip" however my default python is now the anaconda one and no longer accesses pygame. Using which pip gives /Users/jensdonlin/anaconda/bin/pip

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

Does anyone have some suggestions that would allow anaconda's version of python3 to access pygame?

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

Perhaps the answer involves use --allow-external pygame to allow but im not really sure how to use that.


解决方案

这里的问题是pygame开发者没有上传pygame到PyPI.因此,要安装它,您必须下载它并 pip install 下载的源代码,如您链接的教程中所述.您可以在 Anaconda Python 中执行此操作.请注意,在 Anaconda Python 中,即使是 Python 3,pip 也只是称为 pip,而不是 pip3.

The problem here is that the pygame developers have not uploaded pygame to PyPI. So to install it, you will have to download it and pip install the downloaded source, as described in the tutorial you linked. You can do this within the Anaconda Python. Note that in the Anaconda Python, even if it is Python 3, pip is just called pip, not pip3.

相关文章