download pygame for python 3.4 [duplicate] - python

So I have this little problem. When I try to install Pygame for Python 3.4 I download a .whl (wheel?) file and don't know how to use it. Some guys told me something about pip but don't know how to use/install it.

You can install the wheel file for Python 3.4 here:
First you have to install the wheel package from pip then install Pygame.
pip install wheel
pip install pygame‑1.9.2a0‑cp34‑none‑win_amd64.whl
Here's a video to help you install pip on Youtube.

Here is a great VIDEO tutorial: http://goo.gl/PurJqk (it is on youtube)
This is what I use to install .whl modules to python (I do this in the 64 bit windows cmd):
cd "C:\Users\(YOUR USERNAME)\Desktop"
(assuming that you have the .whl file on your desktop)
C:\Python34\Scripts\pip install filename.whl
(where filename.whl is the full name of the .whl file, with the .whl extension)
After that it will install, and you are free to use PyGame!

14 y/o? Good for you! You can put the file into your python/scripts folder and run pip install *file* (where *file* is your filename).

Here is a link to download pygame for different versions of Python, up to Python 3.4 in 32 bit and 64 bit.
To test if it installed properly, open your python shell and type in this code:
import pygame
Please note that these are not official binaries and you are basically trusting a third-party to compile and provide the binary for you.

Step 1
If you have not got python version 3.4.2, then you must uninstall your current version of python (or don't if you don't even have python).
Step 2
Then download and install python 3.4.2 from http://filehippo.com/download_python/58901/ .
Step 3
Follow the instructions and wait until it is ready for use.
Step 4
Now download the 'pygame-1.9.2a0-cp34-none-win32.whl' file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame and copy it into C:\Python34\Scripts .
Step 5
In C:\Python34\Scripts hold the shift key and right click. Click on 'Open new command window here'.
Step 6
In the command window you have opened, type in:
pip3 install pygame-1.9.2a0-cp34-none-win32.whl
It will say something like:
Unpacking C:\Python34\Scripts\pygame-1.9.2a0-cp34-none-win32.whl
Installing collected packages: pygame
Successfully installed pygame
Cleaning up...
And it will then just say C:\Python34\Scripts>, which means that pygame has now been installed!
Step 7
Go to the Python 3.4.2 Shell, and type in:
import pygame
if there is an error, pygame didn't install properly, otherwise, congratulations!
You can then:
import pygame.examples.aliens as game
and then on the next line type in:
game.main()
to see a professional pygame example.
For more information, visit my website at:
https://ronaldobutrus.github.io/Site3/index.html
Good Luck! :)

https://bitbucket.org/pygame/pygame/downloads
"pygame-1.9.2a0-hg_5974ff8dae3c+.win32-py3.4.msi"
This is the package you want, RedNax said this but did not point out the exact package.

The other answer doesn't work for me on Windows 10 Pro N x64.
What did work was installing the win32.whl instead of amd64. I put this in my Python3.4\Scripts folder where pip is and ran
pip install pygame-1.9.2a0-cp34-none-win32.whl
This should work for others using a similar configuration.

In my experience, you need to make sure of two things:
1) Both Python and Pygame should be 32 bit - not either or both being 64 bit.
2) Both Python and Pygame should be compatible for the same version.
You may be able to get the 64 bit version to work, but not all packages have migrated to 64 bit and the small performance improvement isn't worth the frustration of trying to get it to work.
I also found the latest 32 bit Pygame (as of Feb. 5th, 2016) seems to work well with 32 bit Python 3.4.4.
I installed 32 bit python-3.4.4.msi on Windows 10 from my downloads folder to the folder C:\Python34.
Within the Python34 folder, I created a folder called "Project Directory".
In it, I placed "pygame-1.9.2a0-hg_ea3b3bb8714a.win32-py3.4.msi" which I think I got from https://bitbucket.org/pygame/pygame/downloads. Double-clicked on it. Worked the first time.
I had also installed "Microsoft Visual Studio Community 2015 with Update 1."
No idea if this helped solve the problem, but this MVSC package installs a lot of DLLs. It takes quite a while to get MVSC installed.
But - I now have Pygame working on Windows 10.

For linux if you root user then copy paste this into terminal
apt-get install python3-dev mercurial
apt-get install libsdl-image1.2-dev libsdl2-dev libsdl-ttf2.0-dev
apt-get install libsdl-mixer1.2-dev libportmidi-dev
apt-get install python-numpy
pip3 install --user hg+http://bitbucket.org/pygame/pygame
If you not root user then use sudo before start every-line.

Related

I deleted default python on fedora and now getting errors

I recently deleted the default python version on Fedora 31 and installed python 3.9 then made it as default, now I have multiple versions of python.
If I type: whereis python in my terminal this list appear:
python: /usr/bin/python /usr/bin/python3.9 /usr/bin/python3.7 /usr/bin/python3.9-config /usr/bin/python3.7m /usr/bin/python3.9-x86_64-config /usr/lib/python3.9 /usr/lib/python2.6 /usr/lib/python3.7 /usr/lib64/python3.9 /usr/lib64/python3.7 /usr/local/bin/python3.7m-config /usr/local/bin/python3.7 /usr/local/bin/python3.7m /usr/local/lib/python3.7 /usr/include/python3.9 /usr/include/python3.7m /usr/share/man/man1/python.1.gz /usr/src/Python-3.7.4/python
If I type pip then I get ModuleNotFoundError: No module named 'pip'
Also multiple packages are broken such as dnf, argcomplete, pip, etc.
I cannot update or install anything.
How can I solve this problem ?
Grab/Download the original python RPMs for your distro and reinstall them that way if they're not still cached under /var ....
With Python 3.9 you should use pip3...So install python3-pip.
That should do the trick
I tried many solutions and didn't work, however I ended up backing up my data and completely deleting the OS, then I downloaded the last version of fedora and restored my data on it.
thanks for your time
I ran into this unfortunate situation as well on Fedora 35. dnf, yum, and a bunch of other things broke.
I didn't manage to get Python 3.10 back through dnf, yum, or apt-get. I downloaded the rpm from https://fedora.pkgs.org/35/fedora-x86_64/python3-3.10.0-1.fc35.x86_64.rpm.html. It did require a dependency of python3-libs which I downloaded from: https://fedora.pkgs.org/35/fedora-x86_64/python3-libs-3.10.0-1.fc35.x86_64.rpm.html.
I installed python3-libs first with sudo rpm -i python3-libs-3.10.0-1.fc35.x86_64.rpm --force as there were some file writing conflicts. I ran the same command for the python3.10 rpm with the --force flag as well since there were 2 conflicts. After that, everything worked perfectly! Managed to dodge having to do a full reinstall.

Pygame installation for python 3.5

I cannot repeat the instructions to install Pygame for some reason. Instructions are from this website:
https://skellykiernan.wordpress.com/2015/01/04/python-pygame-install/
I downloaded the most recent binary:
pygame-1.9.2a0-cp35-none.win32.whl
I placed this .whl file into the Scripts folder and opened a command window there. Then, following the instructions from the blog above (rather than the instructions from my book, "Python Crash Course," which were next to useless), I typed in the following:
pip3 install pygame-1.9.2a0-cp35-none.win32.whl
What I get back is:
pygame-1.9.2a0-cp35-none-win32.whl is not a supported wheel on this platform.
What am I doing wrong, or is there another, better way to install Pygame for Python 3.5?
I think you are using 64 bit python version. The pygame you are trying to install is for 32 bit version of python. You should try downloading the 64 bits version pygame-1.9.2a0-cp35-none-win_amd64.whl

PyHook on python 3.5

I am trying to write a basic keylogging program on python. I need to install the pywin32 and pyhook modules. I have managed to get pywin32 installed, but cannot seem to pyhook to work. I have read its possible to get it to work on later versions of python, but cannot seem to figure it out. I have tried both .exe and .whl installs. Using whl in cmd gives error that the wheel is not supported. Does anyone have a solution to install pyhook on python 3.5. Thanks
This is how I did it...
Download the py hook module that matches your version of python from here. Make sure that if you have python 32 bit you download the 32 bit module (even if you have windows 64x) and vice versa.
Open your command prompt and navigate to the folder where you downloaded the module
Type "pip install " and then the name of the file.
Ex: "pip install pyHook-1.5.1-cp27-none-win32.whl"
Note : you need pip
If your pip install have not success.
Try -> when you download a pyHook-1.5.1-cp27-none-win32.whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyhook
After that move file to Programs\Python\Python35-32\Scripts path
and then pip install pyHook-1.5.1-cp27-none-win32.whl
I hope my answer is useful for you.

Installing kivy with pip

I get this error when trying to install kivy.
kivy-1.8.9-cp34-none-win_amd64.whl is not supported wheel on this platform.
I run Python 3.4 and have installed these modules:
Pip 6.0.8
Pygame 1.9.2a0
Setuptools 14.3.1
Which is all the latest, so i have no idea what the problem is. I am so excited to create application, with kivy! Annoy me so much that i just can't install it.
I have been following this Tutorial by Sentdex, if anyone is familiar with it.
OS: Windows 8.1 Pro, 64bit
How to install Kivy on windows 10
Download wheels from here (you have to download both pygame and kivy, if you are running 32 bit python3.5 then download Kivy-1.9.1+sdl2-cp35-none-win32.whl and pygame-1.9.2a0-cp35-none-win32.whl or choose the appropriate one for your needs.)
Place installed wheels into same folder.
Run (Windows) CMD as administrator and go into created folder by using cmd (where you placed your wheels)
pip install by copy/paste name of the wheel and push the enter button. For example: pip install pygame-1.9.2a0-cp35-none-win32.whl and pip install Kivy-1.9.1+sdl2-cp35-none-win32.whl
Now you can use Kivy
Good Luck!!
I just wanted to add that I had a similar problem and found that the file name of the wheel is of dire importance. I had downloaded a duplicate copy of the wheel and Windows had auto-renamed it with the suffix "(2)". Using the original file name without this suffix did the trick. Hope that helps someone in the future.
Try to change the python location and the python lib on the path in
environment variable.
ex: path:
C:python/python3.4;
C:python/python3.4/lib

PyOpenGL glutInit NullFunctionError

I am running Anaconda Python 2.7 on a Win7 x64 machine and used
pip install PyOpenGL PyOpenGL_accelerate
at the Anaconda command line to install PyOpenGL.
I have some code (not my own I must confess) that makes use of glutInit
import sys
import math
import numpy
import OpenGL
from OpenGL.GL import *
from OpenGL.GLUT import *
import Image
import linkage
# ... a whole load of definitions etc ...
glutInit(sys.argv)
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
glutInitWindowSize(600, 600)
glutCreateWindow('linkage')
init()
initWindow()
glutIdleFunc(idle)
glutMainLoop()
I run by entering the following at the command line:
python main.py peaucellier.txt
But then get the following error (line 371 is the glutInt(sys.argv) line above)
File "C:/Users/Owner/Documents/Python Scripts/linkage/main.py", line 371, in <module>
glutInit(sys.argv)
File "C:\Anaconda\lib\site-packages\OpenGL\GLUT\special.py", line 333, in glutInit
_base_glutInit( ctypes.byref(count), holder )
File "C:\Anaconda\lib\site-packages\OpenGL\platform\baseplatform.py", line 407, in __call__
self.__name__, self.__name__,
NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling
I have looked at similar errors posted in this forum but none of the proposed fixes are working which is why I'm asking, what's wrong here?
Is the installation at fault? Are the imports correct?
EDIT: After trying many many fixes for the official release I am now using an unofficial release that works perfectly from Unofficial Windows Binaries for Python Extension Packages
According to the link below the problem was with the glut installation rather than pip install. It seems glut files are not part of PyOpenGL or PyOpenGL_accelerate package. You have to download them seperately.
https://stackoverflow.com/a/39181193/7030177
Windows user can use the link below to download glut as mentioned in the given link.
ftp://ftp.sgi.com/opengl/glut/glut3.html.old#windows
Linux Users can just install glut using the following command:
sudo apt-get install freeglut3-dev
Hope this helps :)
After looking around for a solution to a similar problem I ran across this google group that answers the question: https://groups.google.com/forum/#!topic/glumpy-users/aC1NjEHXtEE
There is a problem with OpenGL.GLUT when downloaded as pip from the official source. Uninstall OpenGL using pip, then download OpenGL from http://www.lfd.uci.edu/~gohlke/pythonlibs/
For people on Linux with this error after installing via easy_install PyOpenGL or pip install PyOpenGL.
-> Install the distribution package as: sudo apt-get install python-opengl - this works for me.
If installing PyOpenGL from easy_install, pip or conda, make sure that you have already installed a GLUT implementation, such as FreeGLUT (prebuilt Windows binaries).
For FreeGLUT, copy the distributed files to a location on your hard drive and then add the path to the bin directory (which contains the GLUT DLLs) to your PATH environment variable. Then PyOpenGL should work as expected.
It is mainly because you're running 64-bit windows put pip is installing 32-bit version of PyOpenGL.
To fix this, follow these steps:
Uninstall existing PyOpenGL, Run pip uninstall PyOpenGL PyOpenGL_accelerate
Download the 64-bit builds of PyOpenGL and PyOpenGL accelerate from here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl
How to choose which one to download? Well, first you need to check your python version. Run python --version to determine.
Then according to your version download the whl files for PyOpenGL and PyOpenGL accelerate. For example, if you have Python 3.8, download these 2 files:
PyOpenGL‑3.1.5‑cp38‑cp38‑win_amd64.whl
PyOpenGL_accelerate‑3.1.5‑cp38‑cp38‑win_amd64.whl
Similarly, if you run Python 3.9, download these instead:
PyOpenGL‑3.1.5‑cp39‑cp39‑win_amd64.whl
PyOpenGL_accelerate‑3.1.5‑cp39‑cp39‑win_amd64.whl
Note: Must download amd64 ones, after all, you're running 64-bit windows.
Now go to the folder where you downloaded the files and run powershell/cmd with administrator there.
Use pip to force install those files. For example:
pip install PyOpenGL-3.1.5-cp38-cp38-win_amd64.whl --force-reinstall
pip install PyOpenGL_accelerate-3.1.5-cp38-cp38-win_amd64.whl --force-reinstall
Note: Install PyOpenGL first and then PyOpenGL_accelerate
If the installation succeeds, you may be able now to run.
Some facts to make sure:
*All platforms must be of the same bit version.
*System type, python, OpenGL needs to be of the same bit version. In my case it was x64 bit
*It is necessary to restart your desktop if you reinstall any one of them (Python, OpenGL)
*It is recommended to keep your pip version at 20.3, I downgraded it from 21.1.3
I got the same error and a solved installing required files from here.
Download these files:
PyOpenGL-3.1.1-cp27-cp27m-win32.whl (download if your computer 32 bits )
PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl (download if your computer 64 bits )
PyOpenGL_accelerate-3.1.1-cp27-cp27m-win32.whl (download if your computer 32 bits )
PyOpenGL_accelerate-3.1.1-cp27-cp27m-win_amd64.whl (download if your computer 64 bits )
install these .whl files for 64 bits:
pip install PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl
pip install PyOpenGL_accelerate-3.1.1-cp27-cp27m-win_amd64.whl
install these .whl files for 32 bits:
pip install PyOpenGL-3.1.1-cp27-cp27m-win32.whl
pip install PyOpenGL_accelerate-3.1.1-cp27-cp27m-win32.whl
for python 2.7, PyopenGL needs vc++ 9 compiler, download and install it.
then:
python -m pip install --upgrade pip
pip install image
pip install numpy
pip install PyOpenGL PyOpenGL_accelerate
I downloaded freeglut
unzipped it and added bin directory to the path
when calling: glutCreateWindow("sometitle")
changed to glutCreateWindow(b'sometitle')
and got it run on windows 7
My case is different, Python 3.6 and windows 10. However exactly same error message. Tried all above solutions, no success.
Downloaded WHL file right to my computer and version of python from HERE
Then pip installs filename.Whl, no more issue!
The answer was from a Chinese website: Answer Link
Yes, this happened to me on Windows 10 running python 2.713 anaconda 4 64 bit. I had used conda to install pyopengl but received the same error as above. So I downloaded freeglut from transmissionzero and just copied the freeglut.dll (64 bit for me) to the same directory as my source file (it just needs to be in the dll searchpath) and all was good.
I know it is a little late. I also encountered this problem with python 2.7 (32 bits) in windows. I tried the method mentioned by user2723240 but still failed. Finally, I solved this problem by copying glue32.dll to System32 in C drive and copy glue32.dll into my source file directory. It works well now.
On linux, the pyopengl module attempts to use ctypes module to load the glut library as simply 'glut'. According to ctypes documentation the loadLibrary routine must be given the complete filename. Therefore, I made a symbolic link to libglut.so and named it 'glut' and everything just worked.
The following command should work for Anaconda users:
conda install -c conda-forge freeglut
https://anaconda.org/conda-forge/freeglut
On windows, although PyOpenGL says it installs freeglut by default, it does not.
To patch it, you must download or compile freeglut (other answers here contain the appropriate links) and place it in a new site-packages/OpenGL/DLLS folder inside to your existing OpenGL site-packages installation.
Once there, the freeglut.dll needs to have the bits and the MSVC version appended to the filename. OpenGL/platform/win32.py has the details on exactly how it's detected.
To make it clearer the filename needs to be the one printed from the following script:
import sys
import platform
if sys.hexversion < 0x2070000:
vc = 'vc7'
elif sys.hexversion >= 0x3050000:
vc = 'vc14'
elif sys.hexversion >= 0x3030000:
vc = 'vc10'
else:
vc = 'vc9'
size = platform.architecture()[0].strip('bits')
print(f'freeglut{size}.{vc}.dll')
Step 1
Install python in your system windows 10/11 preferred. for python 3.8.0 : https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe
If you have already installed then check for your python version
Open terminal and type "python --version"
it will display your python version. for example I have installed python 3.8.0.
Step 2
Next open terminal and run the below command
python -m pip install --upgrade pip==20.3
sometimes you have higher version of pip installed but its okay to downgrade back to version 20.3
Step 3
now for installing OpenGL go to this site : https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl
and download
PyOpenGL‑3.1.6‑cp38‑cp38‑win_amd64.whl (for 64bit windows) or
PyOpenGL‑3.1.6‑cp38‑cp38‑win32.whl (for 32 bit)
and
PyOpenGL_accelerate‑3.1.6‑cp38‑cp38‑win_amd64.whl (for windows 64bit) or
PyOpenGL_accelerate‑3.1.6‑cp38‑cp38‑win32.whl (for windows 32bit)
Note : I have in installed python 3.8.0. so I downloaded PyOpenGL having cp38 word in it. If you have installed python 3.9 or other version download the above mentioned file having name cp39,cp10 etc.
after downloading both files according to your python version. put it a folder.
Step 4
then open terminal from that folder. Windows 10 lets you launch Command Prompt in a folder through the File Explorer's address bar. Type “cmd” in the address bar and then hit Enter
after opening terminal enter the below command
pip install PyOpenGL-3.1.6-cp38-cp38-win_amd64.whl --force-reinstall
then after installing it run the below command
pip install PyOpenGL_accelerate-3.1.6-cp38-cp38-win_amd64.whl --force-reinstall
Note : Don't forget to change the file name ( e.g. : PyOpenGL-3.1.6-cp38-cp38-win_amd64.whl) to the file name that you have downloaded.

Categories