Can't import pygame to vs code (mac) [duplicate] - python

This question already has answers here:
Unable to install Pygame using pip
(27 answers)
ImportError: No module named 'pygame'
(25 answers)
Closed 3 months ago.
I can't seem to import pygame into vs code even though I've confirmed it's installed through the terminal using pip.
This is the error it keeps showing,
I've tried changing the interpreter, uninstalling and reinstalling pygame, used different versions of python. None of them seems to be working.
[Running] python -u "/var/folders/2d/y6ktnt4n38s07x3yyvr5gl9h0000gp/T/tempCodeRunnerFile.python"
Traceback (most recent call last):
File "/var/folders/2d/y6ktnt4n38s07x3yyvr5gl9h0000gp/T/tempCodeRunnerFile.python", line 1, in <module>
import pygame
ImportError: No module named pygame
[Done] exited with code=1 in 0.23 seconds

Related

Pygame not importing [duplicate]

This question already has answers here:
ImportError: No module named 'pygame'
(25 answers)
Closed 9 months ago.
I've downloaded pygame version 2.1.2 and I'm using it with python 3.10.4 but it is giving an error when I try to import it:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
I have tried it on vscode and it was working but it suddenly isn't working anymore. Any suggestions please?
Did you try install with pip like this: python -m pip install pygame?
Maybe you can find more answers on this page: ImportError: No module named 'pygame'

how to download inta profile by python [duplicate]

This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 1 year ago.
I wanted to download an insta profile picture so I used this code
import instaloader
ig = instaloader.instaloader()
dp = input("insta user name :" )
ig.download_profile(dp , profile_pic_only=true)
but I faced this erorr:
Traceback (most recent call last):
File "C:/Users/m.h.gh/AppData/Local/Programs/Python/Python38/1.py", line 1, in
import instaloader
ModuleNotFoundError: No module named 'instaloader'
Then I wrote this code
pip3 install instaloader
and faced:
SyntaxError: invalid syntax
I'm using python 3.8.
The command pip3 install instaloader needs to be run in a commandline, not inside your python script.

Pygame doesnt work in PyCharm on Windows 10 [duplicate]

This question already has answers here:
Cannot install pygame in Pycharm
(1 answer)
pycharm doesn't recognize pygame package
(2 answers)
Closed 2 years ago.
I've managed to install pygame on my stationary computer, but when I want to do it on my laptop I get problems.
What I've done:
Installed Git
Installed PyCharm
Installed Python x64:
https://www.python.org/ftp/python/3.7.1/python-3.7.1-amd64.exe
Installed pygame with cmd cd
C:\Users\user\AppData\Local\Programs\Python\Python37 python.exe -m
pip install pygame
Added interpreter in PyCharm: C:\Users\bruker\PycharmProjects\CatAttack\venv\Scripts\python.exe
Error message I got:
C:\Users\bruker\PycharmProjects\CatAttack\venv\Scripts\python.exe
C:/Users/bruker/PycharmProjects/CatAttack/Main.py Traceback (most
recent call last): File
"C:/Users/bruker/PycharmProjects/CatAttack/Main.py", line 1, in
import pygame ModuleNotFoundError: No module named 'pygame'
Process finished with exit code 1
EDIT:
I found out that the error was that I had "interpreter" as a virtual enviroment, and not system enviroment.. Case solved.

Install python pymysql on win7 [duplicate]

This question already has answers here:
Python 3: ImportError "No Module named Setuptools"
(22 answers)
Closed 8 years ago.
So I am completely unfamiliar with python and wanted to install pymysql.
This is the actual command I typed in cmd and the response I got:
C:\>d:\python27\python d:\pymysql\setup.py install
Traceback (most recent call last):
File "d:\pymysql\setup.py", line 2, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
I have python 2.7.8 and MySQL 6.x
I followed the instructions from here.
I haven't tried to search for the error message but have not found anything. Maybe some of you guys can help?
Install setuptools from here first, and then try to install pymysql again.

Python: ImportError: No module named pkg_resources [duplicate]

This question already has answers here:
No module named pkg_resources
(38 answers)
Closed 8 years ago.
In order to run Pelican, I installed python2.7 and modified first line of file /usr/bin/pelican-quickstart
from:
#!/usr/bin/python
to
#!/usr/bin/env python
when I type pelican-quickstart an error occured:
Traceback (most recent call last):
File "/usr/bin/pelican-quickstart", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
I found "pkg_resources" is in this directory:
/usr/lib/python2.6/site-package/
I'm wondering if I have to install some packages after python2.7 is installed?
or, how can I solve this problem.
The problem must be an issue with your setup tools, try the following:
pip install --upgrade setuptools
pip install --upgrade distribute
If this solution doesn't work, you can check the following answer
You said
/usr/lib/python2.6/site-package/
but should be
/usr/lib/python2.6/site-packages/

Categories