Home > front end >  Trouble downloading Python modules
Trouble downloading Python modules

Time:08-01

I was making a Tetris game and at the top of the Python code, I put in import pygame, since that was the thing I was thinking of doing and the thing I thought I could only do. My game was complete, the terminal was open, and I ran the code. The terminal gives an error:

Traceback (most recent call last):
  File "[removed for safety]", line 1, in <module>
    import pygame
ModuleNotFoundError: No module named 'pygame'

So I tried pip installing it with the command pip install pygame, but it just returns a similar error:

Traceback (most recent call last):
  File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python34\Scripts\pip.exe\__main__.py", line 5, in <module>
  File "C:\Python34\lib\site-packages\pip\__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named 'typing'

I was using VSCode, with Python version 3.10.5, 64-bit.

CodePudding user response:

First of all you can uninstall python 3.4 from your system, with enter image description here

After choosing the correct interpreter, you can use command pip install pygame to install python package at the correct python-lib.

  • Related