Pygame doesnt work in PyCharm on Windows 10 [duplicate] - python

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.

Related

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

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

Packages importing in Python - Spyder [duplicate]

This question already has answers here:
ImportError: No module named requests
(33 answers)
Closed 4 months ago.
I'm using Spyder with Python 3.9 and Python 3.7 respectively on Mac and Windows and I got the same issue.
I'm trying to import some packages like:
import pythonnet as clr
or
import yfinance as yf
but I get this message:
File "/var/folders/xs/1_m665393ql86dptnsrft5j80000gn/T/ipykernel_2232/2746914347.py", line 1, in <cell line: 1>
import pythonnet as clr
ModuleNotFoundError: No module named 'pythonnet'
I'm sure that I already installed these packages from the prompt. I'm facing the following issue with many packages so I suppose is it related to the working directory. This is the directory where -pip installs the package by default:
/Users/user_folder/opt/miniconda3/lib/python3.9/site-packages
I'd to understand if the issue is related to the directory and how to efficiently setup it.
Thank you in advance.
It may be that when you are running the script you are trying to run a different version of python.
When you run the pip install try python3 -m pip install instead.
If this doesn't work and you are using vscode you can simply click in the bottom right where it states the python interpreter and change what you are using.
If all of that fails to work, then sorry but that's all I can suggest with my current knowledge.

please how can i really import kivy to pycharm [duplicate]

This question already has answers here:
How to deal with Kivy installing error in Python 3.8?
(5 answers)
Closed 2 years ago.
I installed kivy using the command line as instructed in the kivy.. except for last part which says "python -m pip install kivy==1.11.1" which i tried to install according to the instruction from the site...but its giving me error messages so after some research it seems like python 3.8 does no support kivy..but i did install it manually..the main issue now is that i can't import kivy to pycharm it gives me error message "ModuleNotFoundError: No module named 'kivy'"
please what is the correct way to import kivy to pycharm?
Ok, I just solved Your problem. Use this:
python -m pip install kivy[base] kivy_examples --pre --extra-index-url https://kivy.org/downloads/simple/
Write this on PyCharm terminal and you are done!

Pygame 1.9.6 installed, but receiving ModuleNotFoundError [duplicate]

This question already has answers here:
ImportError: No module named 'pygame'
(25 answers)
Pygame already installed; however, python terminal says "No module named 'pygame' " (Ubuntu 20.04.1)
(1 answer)
Closed 2 years ago.
I'm on Ubuntu 20.04. Today I installed Python 3.8.3 and Pygame 1.9.6 following the instructions on Pygame's wiki. When I tried to test that it worked by typing this in terminal:
python3 -m pygame.examples.aliens
I got this result:
/usr/local/bin/python3: Error while finding module specification for 'pygame.examples.aliens' (ModuleNotFoundError: No module named 'pygame')
However, when attempting to reinstall pygame by inputting:
sudo apt-get install python3-pygame
I get this result:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pygame is already the newest version (1.9.6+dfsg-2build1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
So I know it's installed and up to date, but something isn't making the connection between the two. How do I make Pygame work?

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.

Categories