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 am trying to install Pygame for Python 3.5.1, but it tells me to upgrade to the new version of pip. "You are currently using 7.1.2, use 8.1.2".
Here is a screen shot of it:
The error clearly states Access Denied.
Try to run cmd/powershell as administrator.
The installation error is not because of pip , though you should still upgrade pip
python -m pip install --upgrade pip
Pygame does not have python3.5 support yet. Check the binaries here
Pygame binaries
Try to use Python version 3.4 or 2.7 and then install pygame.
EDIT
You can find unofficial pygame binaries for several Python versions including Python3.5 here.
So if you do not find the official binary, you could try the appropriate file from the above link.
Note: The binaries given there are whl files. So you need to install them using pip.
Example: Assuming you have 32-bit Python installation, run pip install pygame-1.9.2b1-cp35-cp35m-win32.whl
See this answer for more detailed instructions.
Pip seems to be having a permission problem creating this directory: c:\program files (x86)\python35-32\Lib\site-packages\pygame
Here are some things you can try:
Navigate to that directory and see if it already exists. If it does exist, then try deleting it.
Try running pip as an administrator. Right click the command prompt icon and select run as administrator. Your path variables might not be set for the administrator, so you many need to give the full path for pip. In your python folder, it should be in a folder called scripts.
Since you're using Windows, you can also try the binary installers here: http://www.pygame.org/download.shtml
If nothing works you can try installing a different version of Python. I use Python 2.7.8 with pygame.
It was a problem based on the admin command run program and I figures it out.
I am unable to find a pygame download for Python 3.5 and the ones I have downloaded don't seem to work when I import to the shell. Help?
This is the message I receive on the shell:
import pygame
Traceback (most recent call last):
File "", line 1, in
import pygame
ImportError: No module named 'pygame'
I'm gonna guess your using Windows. If you are not then there is no special version of pygame for Python 3+. If you do have Windows then read below.
You will need pygame to be part of your path to do this. This is so you can use this in the command prompt. Make sure you use it as an admin when doing this.
First you need to find out what bit version of Python you have. Open your Python shell and at the top of the window it should say something like "Pygame V(some number) (bit number)" You want the bit number.
Now you ned to open the command prompt. Use the "windows key + r key" to open the run menu, and type "cmd" and press enter. Or you can just search your PC for "cmd" and right click on it and select "run as admin" to open as an admin.
Python comes with a special path command called "pip." I am not gonna get into this module too much, but in short it is used to install addition Python modules. The first thing you need to do is this command...
pip install wheel
The screen should print some stuff off while doing this. You can tell if the module installed correctly because it should print something like "wheel installed successfully." We are gonna need this later.
Now you need to get your pygame file. Go here and find the pygame section. If you have python 32 bit download you should download this "pygame-1.9.2b1-cp35-cp35m-win32.whl" or if you have 64 bit Python download "pygame-1.9.2b1-cp35-cp35m-win_amd64.whl". I am pretty sure these are the ones you need for your bit version, but I installed pygame on my Windows 10 a few months ago so they may be different now.
Once you have this downloaded go back to the command prompt. Enter this command...
pip install (filename)
Make sure it includes the .whl extension. If you get an error then specify the path to the folder the file is in (which should be the downloads folder). Once again you should see a message similar to "pygame installed successfully."
Once all this is done open your Python shell and type...
import pygame
If it works you now have pygame available for use. If not then there are a few more things you can try...
Try restarting your PC. Sometimes these things don't take affect until a system restart.
Try installing a different version of pygame from the website listed above. It may just be a simple issue due to bit version differences.
Make sure you actually installed the pygame module from the file. It may of thrown an error that appeared to be an actual successful installation. It always pays to double-check.
Like I said before I installed pygame on my Windows 10 with Python 3.4 64 bit a few months ago in the same way I told you here so it should work, but may be outdated. Anyways I hope this helps you with your pygame installation issues and the best of luck to you!
For windows now you simply use pip as it's available directly to install as pygame.
Use the following command:
python -m pip install pygame
It should output something like this, then you can test if it's working by importing pygame.
PS C:\Windows\system32> python -m pip install pygame
Collecting pygame
Downloading pygame-1.9.2b1-cp35-cp35m-win32.whl (4.4MB)
100% |################################| 4.4MB 264kB/s
Installing collected packages: pygame
Successfully installed pygame-1.9.2b1
PS C:\Windows\system32> python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
# Note there is no error here...
>>> quit()
PS C:\Windows\system32>
This worked preety well for me:
System: Ubuntu 16.10 x64
root#sonic-VirtualBox:~/python# cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.10
DISTRIB_CODENAME=yakkety
DISTRIB_DESCRIPTION="Ubuntu 16.10"
NAME="Ubuntu"
VERSION="16.10 (Yakkety Yak)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.10"
VERSION_ID="16.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=yakkety
UBUNTU_CODENAME=yakkety
root#sonic-VirtualBox:~/python#
Python 2.7 + Pygame:
root#sonic-VirtualBox:~/python# python -V
Python 2.7.12+
# apt-get install python-pip
# pip install --upgrade pip
# pip install pygame
Python 3.5 + Pygame:
(Python 3.5.2+ in my case)
root#sonic-VirtualBox:~/python# python3 -V
Python 3.5.2+
# sudo apt-get install python3-pip
# pip3 install --upgrade pip
# pip3 install pygame
Download to pygame3.5
Then put this into your cmd
cd [location of python3.5]
python -m pip install [location of pygame]
python -m pip install --upgrade pip
Then type
import pygame
pygame.init()
Even when you have windows 64 bit you need to get the win32.whl file , then follow the standard instructions
In an anaconda environment with python 3.5 installed, you can simply do:
pip install pygame
$pip install pygame
Collecting pygame
Downloading pygame-1.9.3-cp35-cp35m-manylinux1_x86_64.whl (9.4MB)
100% |***************************| 9.4MB 132kB/s
Installing collected packages: pygame
Successfully installed pygame-1.9.3
I'm in ubuntu 14.04, this should work with newer and other linuxes.
I've been spending hours on this. I'm new to Python and can't see what the solution may be.
I have Python 3.4 and want to work with .docx, which requires lxml.
The workflow I've done so far is: I go to the Python lxml package installer page, but it's quite confusing to know which version I need. I tried with several of them that contained the 34 numbers, both .exe and .tar. I also tried pip install lxml3.4.4 and pip install lxml 3.4.4. None of them worked either.
This is what the command prompt says when I did pip install lxml (it automatically grabs the lxml 3.4.4 I've downloaded and then prints what you can see in the screenshot):
What am I doing wrong and what can I do to repair it? And/or what exact version of lxml do I need to install from where? I am really discouraged that this is so difficult. Thanks
As said at the lxml homepage, it happened to you:
If you fail to build lxml on your MS Windows system from the signed and tested sources that we release, consider using the binary builds from PyPI or the unofficial Windows binaries that Christoph Gohlke generously provides.
So you have to download the right wheel file from Unofficial Windows Binaries for Python Extension Packages.
Step 1: Download appropriate version
Depending on your machine you have to download the wheel file lxml‑3.4.4‑cp34‑none‑win32.whl or lxml‑3.4.4‑cp34‑none‑win_amd64.whl, because you want the version for Python3.4 (that's the 34 in cp34).
Step 2: Open cmd and navigate to the download folder
I have chosen to open the cmd in administrator mode. But this is probably not necessary for you.
Step 3: Install wheel file with pip
Now you have to install the unofficial wheel file with pip. Maybe you can do pip install pip --upgrade before you install the wheel file. But this is probably also not necessary for you. To do the installation, just type pip install <downloaded_file>.
Or as cgohlke mentioned in his comment to your question: If you can't do pip install in cmd directly, this is what you can try: C:\Python34\python.exe -m pip install <downloaded_file>. You have to edit the path if Python3.4 is installed elsewhere, of course.
Don't panic. If you try to install the wrong downloaded file (e. g. win32 instead of amd64), it shouldn't break anything. An error message should occur: <package name> is not a supported wheel on this platform.
Sorry, thought i edited to say i am on windows 64 bit
When trying to install Pygame using pip, I get the following error:
"requirement 'pygame.whl' looks like a file name, but the file does not exist pygame.whl is not a valid wheel filename."
I have my file paths right and pip is working. I have attempted to install 32 bit and 64 bit pygame but neither is working. In the command prompt I enter "pip install pygame.whl" (I renamed the file which I don't think should matter and it is saved under downloads).
How can I resolve this error?
It seems there is no PyPi package for pygame. On Ubuntu / Debian you should be able to simply do:
sudo apt-get install python-pygame
Should be similar for other package managers on other distros.
On windows, use the download the provided installer:
Thankyou so much for your help ventsyv, i finally figured it out. i believe it was an issue with the installer from pygames site. i found another site with a link to pygame and specifically for python 3.4.2. i now have no error messages and its working great. Thanks for putting up with me haha.
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.