问题描述
我是python的初学者,我正在尝试安装pygame,但遇到了一些问题。
我遵循了pygame网站上的指示以及许多其他教程,但是仍然无法正常工作。
使用pip3 install pygame
,它将返回
gustavoh@Nitro-AN515-51:~$ python3 -m pip install -U pygame --user
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-olj1e2pe/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-olj1e2pe/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-install-olj1e2pe/pygame/pip-egg-info
cwd: /tmp/pip-install-olj1e2pe/pygame/
Complete output (29 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
/bin/sh: 1: freetype-config: not found
/bin/sh: 1: freetype-config: not found
/bin/sh: 1: freetype-config: not found
Hunting dependencies...
WARNING: "sdl-config" Failed!
WARNING: "pkg-config freetype2" Failed!
WARNING: "freetype-config" 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.
gustavoh@Nitro-AN515-51:~$
使用sudo apt-get install python3-pygame
完成安装,但是我无法在virtualenv中使用该库。
Name: pygame
Version: 1.9.6
Summary: Python Game Development
Home-page: https://www.pygame.org
Author: A community project.
Author-email: [email protected]
License: LGPL
Location: /usr/lib/python3/dist-packages
Requires:
required-by:
(jogos) gustavoh@Nitro-AN515-51:~$ python3
Python 3.8.2 (default,Jul 16 2020,14:00:26)
[GCC 9.3.0] on linux
Type "help","copyright","credits" or "license" for more @R_937_4045@ion.
>>> import pygame
Traceback (most recent call last):
File "<stdin>",line 1,in <module>
ModuleNotFoundError: No module named 'pygame'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)