I've had python 3 insalled on my system for a few months and have never had an issue importing libraries before. After using pip3 to install pygame, IDLE couldn't find the pygame library:
Traceback (most recent call last):
File "/Users/williamh/unit-6-project-music-pyer/code/player pygame rewrite.py", line 3, in <module>
import pygame.mixer as mixer
ModuleNotFoundError: No module named 'pygame'
I have tested a sample program from command line, and pygame seems to be working and installed. Both IDLE and Visual Studio Code give modulenotfound errors. I have tried updating .zprofile with the path pygame was installed under:
# Setting PATH for Python 3.9
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
export PATH
PATH="/opt/homebrew/lib/python3.9/site-packages:$PATH"
export PATH
eval "$(/opt/homebrew/bin/brew shellenv)"
The only new lines added to .zprofile are the 2nd "PATH" command and the 2nd "export PATH" After restarting my mac, it still wont load. Here's my system specs:
MacBook Pro (13-inch, M1, 2020)
Chip: Apple M1
Memory: 8 GB
Terminal Default Shell: -zsh