A
A
Alexey Babiev2019-11-25 14:46:09
Python
Alexey Babiev, 2019-11-25 14:46:09

How to install pygame_sdl2 for python3 if there are multiple versions of python on the system?

I have ubuntu 16.04 with a cinnamon shell that pulls in python 2.7 on install. Additionally, python 3.6 was installed for development
. Installation of pygame_sdl2 was required, but here's the catch - it sudo apt install python-pygame-sdl2installs the library for 2.7, but it is necessary for 3.6
Share your experience in solving the issue. I'm sure I'm not the first one to come across

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Gilfanov, 2019-11-25
@axsmak

To get started, try following the official documentation :

Ubuntu:
sudo apt-get install build-essential python-dev libsdl2-dev \
    libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
    libjpeg-dev libpng12-dev virtualenvwrapper

Open a new shell to ensure virtualenvwrapper is running, then run:
mkvirtualenv pygame_sdl2
pip install cython

Change into a clone of this project, and run the following command to modify the virtualenv so pygame_sdl2 header files can be installed in it:
Finally, build and install pygame_sdl2 by running:
If the library will not be available for import in Python3, try replacing the calls pythonto python3and pipto in the instructions above pip3. And try again.
There is also a suspicion that the instructions are missing:
git clone https://github.com/renpy/pygame_sdl2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question