首页 > 解决方案 > 无法使用 conda 安装 Pygame

问题描述

我试图使用 conda 安装 Pygame 模块。

我使用了这个命令:

conda install pygame

它给了我以下错误:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - pygame

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

然后我使用了以下命令:

conda install -c cogsci pygame

输出:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata         source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
Examining python=3.7: 100%|██████████████████████████████████████████████████████████████| 2/2     [00:00<00:00, 11.12it/s]-failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pygame -> python[version='2.7.*|3.5.*']

Your python: python=3.7

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

我已经使用 conda install 安装了不同的模块,例如 tensorflow、numpy、pandas、matplotlib,它们都在工作,但它在 pygame 中给了我一个错误。如何修复它并安装 Pygame?

标签: pythonpygamecondaanaconda3

解决方案


pygame 包已有cogsci4 年历史,仅与 python2.7 兼容。如果您想要最新版本,请使用pip install pygame. evindunn我个人使用仅适用于 linux-64的 conda 包


推荐阅读