I am trying to run this code:
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
But I get this error:
Traceback (most recent call last):
File "/Users/Abood/Documents/lol.py", line 3, in <module>
from OpenGL.GL import *
ModuleNotFoundError: No module named 'OpenGL.GL'
I tried removing the .GL part and this came up:
Traceback (most recent call last): File "/Users/Abood/Documents/lol.py", line 4, in <module> from OpenGL.GLU import * ModuleNotFoundError: No module named 'OpenGL.GLU'
You have to install both the pygame and OpenGL packages. The easiest way is using pip:
pip install pygame
pip install PyOpenGL
This worked for me. After installing the packages and running your code, I got:
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
There are also different ways to install the OpenGL module. See the installation instructions on the PyOpenGL website.
Related
I want to import gtts. I wrote "import gtts" But it shows me a failure because he didn't know gTTS. I've already installed gtts with "pip install gtts" but it still didn't work. Please help.
Thanks
error:
PS C:\Users\dealt> & C:/Users/dealt/AppData/Local/Programs/Python/Python311/python.exe
{file}
Traceback (most recent call last):
File "c:\Users\dealt\Desktop\Durchsage.py", line 1, in <module>
import gtts
ModuleNotFoundError: No module named 'gtts'
I am trying to import gTTS
I have installed sip-4.19.13 and PyQt5_gpl-5.11.3 (by specifiying ./configure.py --sip <path>) on a Raspberry PI 3 from sources (no packages found with apt or pip).
However, I can't manage to run qtdemo.py in the examples folder:
>>> from PyQt5 import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: PyCapsule_GetPointer called with incorrect name
How can I fix it? I've googled it but not found any solutions...
I have the same problem with installed PyQt5_gpl-5.12,
from PyQt5.QtWebEngineWidgets import * ValueError: PyCapsule_GetPointer called with incorrect name,
then pip uninstall PyQt5 and pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyqt5==5.10.1
In my code
from pygame.locals import *
gets the following error message:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from pygame.locals import *
ImportError: No module named 'pygame.locals'
I have ensured that I don't have any files named pygame.py or pygame.pyc in my working directory and I'm using Python3.3.5 and pygame-1.9.2a0-hg on Windows 10. Could there be any other reason for this error?
Using Pycharm. My python file was called pygame. When I copied and pasted the code into another python file with a different name, it worked. This is as new to me as anything.
I have installed PyQt using brew but when I am trying to import it, I just receive errors as follows:
>>> from PyQt4 import QtCore, QtGui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4
>>> from PyQt5 import QtCore, QtGui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PyQt5
Here's the command I used in terminal for installing PyQt in OSX:
brew install python qt pyqt pyside pyside-tools
Any idea what's gone wrong?
The most painless way to do python without messing around with modules is to install distributions. Two very good ones are Canopy Python and Anaconda. They have most, if not all, modules you are going to need for production. Pyqt and pyside are included in both of these distributions.
I am using a mac and i want to use pygame but it is not working.
this is the error i get when I try to do import pygame
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import pygame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
Please help I am using python 2.7.9
If your file name is called pygame.py the system imports your python file.
If your file name is not pygame.py, you can try doing pip install pygame or python -m install pygame.