1

I've read all of the feedback on here in regards to the AttributeError: 'module' object has no attribute 'init' prompt and still haven't figured out the solution to this issue. I've tried everything as far as I know. I'm using Python 3.5, Windows 7 64 bit. I made sure that I have the correct python and pygame versions but still no luck. Would someone please assist me-thank you.

  • 1
    always show full error message (traceback). – furas Nov 03 '16 at 20:32
  • did you use `pygame` name for your file or folder ? Than now Python imports your file instead original module. Check `print(pygame.__file__)` to see what file did you import. – furas Nov 03 '16 at 20:33
  • So I reinstalled everything and got the following...Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ============== RESTART: C:/Users/dlack/Documents/FridaysTest.py ============== Traceback (most recent call last): File "C:/Users/dlack/Documents/FridaysTest.py", line 1, in import pygame ImportError: No module named 'pygame' >>> – user7082375 Nov 04 '16 at 13:57
  • Add error message in question, not in comment – furas Nov 04 '16 at 14:29
  • Did you install `pygame` for your Python version - 3.5.2 , 64bit ? `pip3 install pygame` ? – furas Nov 04 '16 at 14:29
  • Yes I installed 3.5.2/64bit – user7082375 Nov 04 '16 at 15:14
  • maybe you have two Pythons - you use one to run script and other to install pygame. You can try `python -m pip install pygame` and later `python FridaysTest.py` – furas Nov 04 '16 at 15:32
  • I'm sorry, could you elaborate please? – user7082375 Nov 04 '16 at 15:47
  • you can have two Pythons installed. Every Python use own folder with modules and use own `pip` to install modules in this folder. So you can have two `python.exe` and two `pip.exe`. You can use first `python.exe` to run scripts but you can use second `pip.exe` to install `pygame` - so only second `python.exe` can have this module. And this is very often problem - at least on Linux. – furas Nov 04 '16 at 16:01
  • (see previous comment) Open console/terminal/cmd.exe/powershell and run `/full/path/python.exe -m pip install pygame` to install `pygame` and later run `/full/path/python.exe /full/path/FridaysTest.py` to test your script again. This way you use the same Python to install `pygame` and to run script. – furas Nov 04 '16 at 16:01
  • Aaah makes sense. I'll go back and take into account and retrace my tracks and will let you know how it turns out-thank you – user7082375 Nov 04 '16 at 16:40

0 Answers0