0

I recently bought a new laptop and installed ubuntu. I messed around with bash and learned that I there is a default python interpreter. However, the biggest problem that I face is that I can't get it to import pygame, a neat package that I've used in some projects. python3 gives me "ModuleNotFoundError: No module named 'pygame'".

I've scoured around the Internet to find a meaningful solution but only came across someone mentioning /usr/bin/python3. I used it on terminal and did not produce any errors. I couldn't get what the rest of the post was saying because it turned too technical for me (My knowledge in programming is very limited as you have guessed).

Ultimately, what I want is for my vs code to execute python3 without giving errors on the import lines. Or at the very least, I need to be able to run a script in terminal without any preliminary errors so I can debug my own code peacefully. It is also giving me a weird error saying that I don't have pip, again, I already got it installed with:

sudo apt-get install python-pip

Or something similar to it.enter image description here

EDIT As pointed out by Kumpel Gras, The root of my problems was that I had only installed pip instead of pip3. I managed to get things working after installing python3-pip

1
  • You should tell us your release of Ubuntu. Ubuntu has been moving away from python 2 (to Python 3) so there are slight differences depending on your Ubuntu release. wiki.ubuntu.com/Python
    – guiverc
    Commented Feb 10, 2019 at 10:56

1 Answer 1

1

python-pip is the package for Python 2.

You need to install python3-pip and then use pip3 to install your Python 3 modules.

If you want to run your Python 3 code from the command line you also have to use python3, as just python is usually linked to Python 2. You can check for the python version using python --version or also pip --version.

1
  • Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you! Commented Feb 10, 2019 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .