• Python 3: can't import pygame!


    I install python-3.6.1-1

    $ sudo pacman -S python3
    

    I try to install pygame but not exist and then i found only in pacman and yaourt the python2-pygame 1.9.3-1 and installed:

    $ sudo pacman -S python2-pygame
    

    After i try to import pygame in python 3 and i can’t:

    Python 3.6.1 (default, Mar 27 2017, 00:27:06) 
    [GCC 6.3.1 20170306] on linux
    Type "copyright", "credits" or "license()" for more information.
    >>> import pygame
    Traceback (most recent call last):
      File "<pyshell#0>", line 1, in <module>
        import pygame
    ModuleNotFoundError: No module named 'pygame'
    >>> import python2-game
    SyntaxError: invalid syntax
    >>> 
    

    Please help me with this ! ! !
    Thanks.

  • Hey @astrolavos
    You have installed the library for Python 2 and Python 2 libraries don’t work with Python 3
    I don’t think there is a package on pacman for Python 3

    Try installing

    sudo pacman -S python-pip
    

    Then run

    python3 -m pip install pygame --user
    

    If you need more info you can go to pygame website
    https://www.pygame.org/wiki/GettingStarted

    Hope this helps

  • @pyUser Finaly … yeahhh this is the solution… thanks!!! :)

import2 pygame3 python9 Posts 3Views 481
Log in to reply