简体   繁体   中英

problem with installing Pygame on Anaconda

I want to install pygame on python. I have ubuntu 20.04 (which has python3.8 already installed) and Anaconda.
pip is connected to Anaconda: which pip shows it's at /home/mohammad/anaconda3/bin/pip .

I use pip to install pygame on Anaconda . But pip install pygame shows error. How can I install pygame on Anaconda?

I can simply install pygame by deactivating Anaconda Enviroment and using pip which installs it on system python (It shouldn't have any problem). But I want to have pygame on Anaconda.

I don't really know where the problem is.

$ 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

Please try running the above mentioned code on your platform.

There isn't a build of 2.0.0.dev3 for Python 3.8. Python 3.8 wasn't out when dev3 was released. You want the latest, so change your command to that.

However, if that also doesn't help you as well, try sudo apt install python3-pygame

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM