0

I was using python 32-bit and pygame worked perfectly fine, but then I needed python 64-bit to get another module. Now python 64-bit is set to my standard python, so every time I try to open my programs with pygame in them it crashes instantly, and I have to open them with IDLE 32-bit and then press F5 to run them, which is annoying.

I was wondering if it is possible to get pygame to work with python 64-bit.

I tried pip installing pygame for 64-bit, but it said it was already installed.

If it is impossible to get pygame to work with 64-bit python, please tell me how to change it so that 32-bit python is the default.

I am using python 3.6.4 by the way.

Thank you

Micheal O'Dwyer
  • 1,237
  • 1
  • 16
  • 26
  • What operating system are you using? You can download 64-bit pygame for Windows but not for Mac. – Micheal O'Dwyer Feb 25 '18 at 22:13
  • I am using windows – Alexander Pedersen Feb 25 '18 at 22:13
  • Someone correct me if I am wrong, but you should be able to just download the `win_amd64` installer from the PyPI [pygame package index](https://pypi.python.org/pypi/Pygame). Match up the version of Python that you are using with the version in the download file name. For example, `cp34` relates to Python 3.4. Once you have downloaded the `.whl` file you can look at [this article](https://www.webucator.com/blog/2015/03/installing-the-windows-64-bit-version-of-pygame/) which will tell you how to install the wheel file using pip. – Micheal O'Dwyer Feb 25 '18 at 22:28
  • when i try to do that, it says the requirement is already met... also when i try to run a game with pygame in it it says: `Traceback (most recent call last): File "C:\Users\alexa\Desktop\spil\bat og python\Python\racing game.py", line 1, in import pygame File "C:\Users\alexa\AppData\Roaming\Python\Python36\site-packages\pygame\__init__.py", line 133, in from pygame.base import * ModuleNotFoundError: No module named 'pygame.base'` – Alexander Pedersen Feb 25 '18 at 22:42
  • Ok, run `pip --version`. The output should show a version of Python. It is likely going to the 32 bit Python but run it just to make sure. – Micheal O'Dwyer Feb 25 '18 at 22:48
  • It does not say if it is 32 bit or 64 bit it just says: `pip 9.0.1 from [path] (python 3.6)` – Alexander Pedersen Feb 25 '18 at 22:52
  • If i run `python` in cmd it says 64 bit – Alexander Pedersen Feb 25 '18 at 22:53
  • My path says `python36-32` in the path. You might be able to figure out the version from the path it gives. – Micheal O'Dwyer Feb 25 '18 at 22:56
  • Since I am nearly certain the issue is that the wrong version of pip is being used, try [this answer](https://stackoverflow.com/a/34803087/8390068). It allows you to specify the version of python to use. If the versions of python are the same, then you may need to specify the full path to the 64 bit version of python that you want to install pygame on. – Micheal O'Dwyer Feb 25 '18 at 22:58
  • mine just says `python36` – Alexander Pedersen Feb 25 '18 at 22:58
  • so i tried some of the things they said in that thread, and no matter what it just says requirement already met. I'm not sure about the full path thing though, I could not get that to work it just opens the window where i can modify, repair, or uninstall python when i tried `[Full path] pip install pygame` – Alexander Pedersen Feb 25 '18 at 23:19

1 Answers1

2

Perhaps try uninstalling pygame first.

py -m pip uninstall pygame
py -m pip uninstall pygame
py -m pip install pygame --user

Additionally you could try running pip from inside your python(or IDLE). Note, you have to restart IDLE after it has installed using this method.

>>> import pip
>>> pip.main('uninstall pygame'.split())
>>> pip.main('install pygame --user'.split())

The webpage with up to date install instructions is here: https://www.pygame.org/wiki/GettingStarted

René Dudfield
  • 591
  • 4
  • 10
  • Thank you so much for helping me. In the end there was quite a simple solution. I simply uninstalled pygame and indtalled it again... And now it works. – Alexander Pedersen Feb 26 '18 at 02:09