Pygame help 2.7 - python

I have installed pygame for python 2.7 but this come up if I type import pygame
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
File "C:\Python27\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
Please help me

According to pygame download page NOTE:
windows 64bit users note: use the 32bit python with this 32bit pygame.
Make sure you're using 32bit version of Python.

I have had this problem recently, i have found that if you are using a 64 bit machine, then you need the 64 bit version of python and the 64 bit version of pygame. The 64 bit version of pygame is not available on the main website but you can download it from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/
I would suggest uninstalling python 2.7 and reinstall the 64 bit version of it from the python download page. when you install pygame, use the file called "pygame‑1.9.2a0.win‑amd64‑py2.7.exe" (without the quotes) on http://www.lfd.uci.edu/~gohlke/pythonlibs/
Good luck.

I had this problem and solved it. I found a 64 bit pygame version at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
Select pygame-1.9.2a0-cp27-none-win_amd64.whl (for python 2.7) from the list of options available.
Copy the downloaded file to path/to/python27/Scripts
Then use pip installer.
Install wheel package first if you don't have it already. It is used to extract and install whl files.
Open cmd.
cd path/to/python27/Scripts
pip install wheel
pip install pygame-1.9.2a0-cp27-none-win_amd64.whl
Hope that solves it.

Related

ImportError Pyo

I'm trying to import pyo in python3.8.8 and I'm not getting any results. When I try to run the command:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
import pyo
File "C:\Users\andre\AppData\Roaming\Python\Python38\site-packages\pyo_init_.py", line 28, in
from .lib import analysis as analysis
File "C:\Users\andre\AppData\Roaming\Python\Python38\site-packages\pyo\lib\analysis.py", line 32, in
from ._core import *
File "C:\Users\andre\AppData\Roaming\Python\Python38\site-packages\pyo\lib_core.py", line 58, in
from .._pyo import *
ImportError: DLL load failed while importing _pyo: Impossibile trovare il modulo specificato.
How can I solve this?
I assume you are on windows. What version of pyo do you have installed? I saw that it was only version 1.0.1 that python 3.8 support was introduced. Try uninstalling pyo, then make sure you install the newest version. Also, did you install with pip? If you did, try installing from their downloadable releases on github. What code did you write that caused this error? I need to see your code.
Looks like you're using pc032 (032bit) Python. Last PyO version with pc032 (on Win) support is [PyPI]: pyo 1.0.1 (from 191127). But I didn't see the Python 3.8 .whl among files (neither for a couple of older versions).
Just out of curiosity: how did you install PyO?
In order to get things going either:
Switch to pc064 (064bit) Python
Use a (pc032) Python version that prebuilt .whl exists for
I've built v1.0.4 (latest at answer time) and placed the .whls at [GitHub]: CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/PyO/v1.0.4. Download and install the preferred one (check [SO]: Installing pygraphviz on Windows 10 64-bit, Python 3.6 (#CristiFati's answer) (at the end) for more details about the process)

Not able to import Python packages

Not able to install any packages
I've tried VLC package from https://wiki.videolan.org/python_bindings
and got a traceback.
Now I am trying pygame module and this is what i get
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pygame
File "C:\Users\Vineeth\AppData\Local\Programs\Python\Python36-32\lib\pygame\__init__.py", line 133, in <module>
from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.
Please help i am pretty new to python
There are some release binaries for Python3.x, 64bit Windows at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
I suggest you download it from that site and install it. It works for me. If you are using Windows ,it is a good way to install some packages,like lxml matplotlib.
Also you check out this question.
Hope this helps.
I tried to execute your statements and the imports worked fine for me. I have a 64bit Windows OS. And my python version Python 3.5.2 - 64bit.
Check if you have other Python versions, if you have removed them, make sure you did that right.
Ultimately I would just suggest you to do pip install pygame. The version compatibility will be handled by pip itself.

'ImportError: DLL load failed:' in pygame module

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
File "C:\Program Files (x86)\Python35-32\lib\site-packages\pygame\__init__.py", line 127, in <module>
from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.
Ensure that the version of PyGame you're using matches the version of Python you're using!
You have not installed Pygame correctly or not in the correct directory/file. What python version do you use and is your computer 32/64 bit?
Thx
This is a late answer, but may be it helps someone.
The pygame binary you use should be built for the Python version you have in your system.
In your case, you seem to have 32-bit Python3.5.
There is no official pygame binary for Python3.5 yet. But unofficial binaries are available here.
Download pygame-1.9.2b1-cp35-cp35m-win32.whl from the link (this is the 32-bit version for 32-bit Python3.5), and install it using pip.
Example: cd to the folder where you downloaded the .whl file, and run C:\Program Files (x86)\Python35-32\Scripts\pip install pygame-1.9.2b1-cp35-cp35m-win32.whl
Note:
pip may not play well when the python install directory has spaces. So please install python in a path without spaces. For example, C:\Python35-32 instead of C:\Program Files (x86)\Python35-32.
Also, see this answer in case you need more info on installing .whl files.

Pygame installation for Python 3.3

I am trying to import Pygame to use for my version of Python, 3.3. The downloads on the Pygame website only have Python 3.1 and 3.2. I cannot seem to be able to import Pygame though I thought I had it installed in the correct path. I have tried both the 3.1 and 3.2 Pygame downloads.
Is Pygame just not installed in the correct file path or is Pygame not compatible with my version of Python (3.3)?
I am running Windows 7 and here is the error:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import pygame
File ".\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.
The main Pygame page seems to be rarely updated. You can download Pygame releases direct from Bitbucket at https://bitbucket.org/pygame/pygame/downloads.
If the solution from the Paul Vincent Craven's answer gives you "Python version 3.3 required, which was not found in the registry.", you have to download and install this version from the official download site:
Python 3.3.0 Windows X86-64 MSI Installer
If you are on Windows and have Python 3.3, open the download page on bitbucket. Download: pygame-1.9.2a0.win32-py3.3.msi
Then you can test if you have Pygame by importing pygame.
Every time I update my python verion (currently I'm working with python 3.3), I download a special build for pygame, from this adress. It has builds for many other packages, so I think it is worth to check it out.
I have had this problem also. Pygame has to be compatible with the version of Python and the type of computer you have. For example, if you have Python version 3.3.2, but downloaded Pygame version 2.7.1, the "import pygame" function will be impossible to use.
You need to download the version of Pygame that is equivalent to Python 3.3 from Bitbucket and Pygame is only available in 32 bit, so you need to make sure that Python is 3.3 32 bit. Download from: https://bitbucket.org/pygame/pygame/downloads
sudo apt-get install python-pygame
Raise some errors like 404 for some packages so
https://community.webfaction.com/questions/315/how-do-i-install-pygame
This link help full for me

pygame for python 2.7.3

I had installed python 2.7.3 on windows 7 and now I want pygame for it. I even installed pygame 1.92 a0 but it doesn't seem to be working . Could anybody help to solve this problem? I had also tried with pygame 1.9.1 but when I am typing "import pygame' on gui, I get an error message:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import pygame
ImportError: No module named pygame
Do I need to set any path while installing?
You will want to download the version pygame-1.9.2a0.win32-py2.7.msi. You can search for it at this website, or download directly from this page by clicking here. If you download properly, it should run fine. Be sure to uninstall the old versions of pygame first.
Just follow the instructions. Hope it helps you.
Source: https://inventwithpython.com/pygame/chapter1.html
Installing Pygame
Pygame does not come with Python. Like Python, Pygame is available for free. You will have to download and install Pygame, which is as easy as downloading and installing the Python interpreter. In a web browser, go to the URL https://www.pygame.org/download.shtml. These instructions assume you have the Windows operating system, but Pygame works the same for every operating system. You need to download the Pygame installer for your operating system and the version of Python you have installed.
You do not want to download the "source" for Pygame, but rather the Pygame "binary" for your operating system. For Windows, download the pygame-1.9.1.win32-py3.2.msi file. (This is Pygame for Python 3.2 on Windows. If you installed a different version of Python (such as 2.7 or 2.6) download the .msi file for your version of Python.) The current version of Pygame at the time this book was written is 1.9.1. If you see a newer version on the website, download and install the newer Pygame.
For MacOS, download the .zip or .dmg file for the version of Python you have and run it.
For Linux, open a terminal and run: sudo apt-get install python-pygame.
On Windows, double-click on the downloaded file to install Pygame.
To check that Pygame installed correctly, type the following into the interactive shell:
>>> import pygame
If nothing appears after you hit the Enter key, then you know Pygame has successfully been
installed. If the error ImportError: No module named pygame appears, then try to install Pygame again (and make sure you typed import pygame correctly.

Categories