'in vscode, pygame wont import but it is installed and is working in the windows console ,and the python app thing
Solution 1:[1]
You can use pip show pygame
to view the package installed location.
And check whether the installation location is consistent with the version corresponding to the selected Python interpreter.
There are two ways to solve this problem:
- "ctrl+shift+P" and change the python interpreter.
- If you don't want to change the interpreter, you can use
pip -t flodername pygame #flodername is your used python package location
. Install the pygame package to the specified directory
Solution 2:[2]
First, try restarting your computer or vs code
Use this command in your vs code terminal if the above doesn't work:
pip uninstall pygame
Then reinstall pygame using:
pip install pygame
If this also does not work then follow these steps:
Go to the scripts folder of python.
Open
command prompt
orPowershell
in the script folder.Use this:
C:\python34\scripts> python -m pip install pygame
Done
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | MingJie-MSFT |
Solution 2 | MEHUL VERMA |