How do I download Pygame for Python 3.5.1?

前端 未结 6 1596
醉梦人生
醉梦人生 2021-01-18 09:06

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 recei

6条回答
  •  被撕碎了的回忆
    2021-01-18 09:45

    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...

    1. Try restarting your PC. Sometimes these things don't take affect until a system restart.
    2. Try installing a different version of pygame from the website listed above. It may just be a simple issue due to bit version differences.
    3. 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!

提交回复
热议问题