python-3.x – Python 3.5.0 :::: Instalar pygame

Question:

I've tried installing pygame on python IDLE using pip but it didn't work, however I found a download that installed me in a folder with pygame ready to install on my local drive. When I installed pygame and opened python I did: import pygame, but when I run the module it says there is no 'pygame' module.

>>> import pygame
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
ImportError: No module named 'pygame'
>>> 

Do you know how to install it? How do I solve this problem?

I use python 3.5.0 and Windows 10 pro

Answer:

Note: I wrote this answer here on Stack Overflow, but I couldn't send the links in the message (the site says I don't have "reputation" for indicating more than 2 links per message). Therefore, I left this same message in TXT format, with the necessary links, at the following address:

https://drive.google.com/file/d/0B88rg0vKkrOFdmdKMmx0TEk5SHc/view?usp=sharing


Hi!

I have 64-bit Windows 10, and I managed to get Python and Pygame to work, like this:

1) I went to the Python website (see TXT from the link above), and downloaded Python 3.5.1 (from 12/07/2015), and installed it.

If I'm not mistaken, during installation I clicked on the custom installation option, and selected the option "for all users", change environment variables, and left the default folder, which in my case was "C:\Program Files\ Python35". If you don't go into the custom installation, I think later you'll have to add the Python path (folders) manually, in the Windows environment variable "PATH".

Just informing: At the command prompt (CMD), when typing the PATH command, I noticed that the installer added the following folders, right at the beginning of the path:

C:\Program Files\Python35\Scripts\;C:\Program Files\Python35\;

2) I went to the PyGame website (see TXT from the link above) and selected the PyGame version corresponding to the Python version I mentioned in item 1. The version I downloaded was this:

pygame-1.9.2a0-cp35-none-win_amd64.whl

Obs.: As far as I could find out, in the filename, "cp35" means it's the 3.5 version of PyGame, and "amd64" means it's the 64-bit version.

3) I watched the video https://www.youtube.com/watch?v=MdGoAnFP-mU , and followed its instructions.

  • The video is about older versions of Python 3.4.1 and PyGame, but with the newer versions I mentioned in items 1 and 2, it worked.
  • The author of the video will ask you to enter certain addresses, click certain menus, etc. However, in this part, you just have to enter the two links I mentioned above, and you will arrive directly at the necessary files.
  • The part you will have to follow strictly is from when it comes to renaming the .whl file to .zip, copying files into the Python folder, etc.
  • Remember to adapt the folders mentioned in the video to YOUR Python folder.
  • In my case, where the video mentions the "C:\PythonXX" folder, I used the "C:\Program Files\Python35" folder, which is where I installed Python (assuming, as I said, the default installer folder ).

  • Another precaution to take is that, in the instructions written in the video, reference is made to a folder called "pygame-1.9.2a0.dist-info", but a few minutes later the author of the video corrected it to "pygame-1.9.2a0. date". I draw your attention to this detail because, if you decide to stop the video at the beginning of the instructions and follow them as they are there, you will not know that, later on, the name of this folder has been corrected. So, I suggest you actually go through the instructions as you watch the video, without jumping or trying to anticipate anything.

4) Perhaps you would prefer to install Python in some other folder of your choice (C:\Python35, for example), and I SUPPOSE that this should work. However, whatever programs I install, I have a habit of always accepting the default installers folder, precisely so as not to run the risk of running into some annoying error due to an installer problem.

If you are going to risk installing Python in a folder other than the "default" installer, and in case PyGame doesn't work, I suggest you UNINSTALL (through the Windows control panel) the version you installed, and try to reinstall , this time using the default folder.

5) Unfortunately, if these instructions don't work for you, I won't have much more to say, as I'm new to Python and PyGame.

Good luck! Paul

Scroll to Top