在 Anaconda 上安装 Pygame 时出现问题
problem with installing Pygame on Anaconda
我想在 python 上安装 pygame。我有 ubuntu 20.04(已经安装了 python3.8)和 Anaconda。
pip 已连接到 Anaconda:which pip
显示它位于 /home/mohammad/anaconda3/bin/pip
.
我使用 pip 在 Anaconda 上安装 pygame。但是 pip install pygame
显示错误。如何在 Anaconda 上安装 pygame?
我可以通过停用 Anaconda 环境并使用 pip 将其安装在系统 python 上来简单地安装 pygame(应该没有任何问题)。但是我想在 Anaconda 上安装 pygame。
真不知道问题出在哪里
$ pip install pygame
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: /home/mohammad/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z7x7jtmx/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z7x7jtmx/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ctnap_n6
cwd: /tmp/pip-install-z7x7jtmx/pygame/
Complete output (25 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...
/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Hunting dependencies...
WARNING: "sdl-config" failed!
WARNING: "pkg-config freetype2" failed!
Unable to run "sdl-config". Please make sure a development version of SDL is installed.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
python3 -m pip install pygame==2.0.0.dev6
请在您的平台上尝试运行上述代码。
Python3.8 没有 2.0.0.dev3 的构建。 Python dev3 发布时 3.8 尚未发布。你想要最新的,所以把你的命令改成那个。
但是,如果这对您也没有帮助,请尝试 sudo apt install python3-pygame
我想在 python 上安装 pygame。我有 ubuntu 20.04(已经安装了 python3.8)和 Anaconda。
pip 已连接到 Anaconda:which pip
显示它位于 /home/mohammad/anaconda3/bin/pip
.
我使用 pip 在 Anaconda 上安装 pygame。但是 pip install pygame
显示错误。如何在 Anaconda 上安装 pygame?
我可以通过停用 Anaconda 环境并使用 pip 将其安装在系统 python 上来简单地安装 pygame(应该没有任何问题)。但是我想在 Anaconda 上安装 pygame。
真不知道问题出在哪里
$ pip install pygame
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: /home/mohammad/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z7x7jtmx/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z7x7jtmx/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ctnap_n6
cwd: /tmp/pip-install-z7x7jtmx/pygame/
Complete output (25 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...
/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Hunting dependencies...
WARNING: "sdl-config" failed!
WARNING: "pkg-config freetype2" failed!
Unable to run "sdl-config". Please make sure a development version of SDL is installed.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
python3 -m pip install pygame==2.0.0.dev6
请在您的平台上尝试运行上述代码。
Python3.8 没有 2.0.0.dev3 的构建。 Python dev3 发布时 3.8 尚未发布。你想要最新的,所以把你的命令改成那个。
但是,如果这对您也没有帮助,请尝试 sudo apt install python3-pygame