No module named 'splashkit' in Python error
Solution(s)
1. Install python using homebrew
If you haven’t installed homebrew, or homebrew’s python package, follow the steps below:
-
Install Homebrew.
-
Install python, using homebrew with the following command:
Terminal window brew install python@3.13 -
Add homebrew to your path using the steps in the 2. Add Homebrew to your PATH using terminal or 3. Add Homebrew to your PATH manually solutions below.
2. Add Homebrew to your PATH using terminal
-
To add ‘dotnet’ to your PATH, run the following command:
Terminal window echo "eval \"\$(/opt/homebrew/bin/brew shellenv)\"" >> ~/.zshrc -
Apply Changes
Save the
.zshrc
Reload the.zshrc
paths with the following command to apply changes immediately:Terminal window source ~/.zshrc
3. Add Homebrew to your PATH manually
To resolve this, add this line: eval "$(/opt/homebrew/bin/brew shellenv)"
to your .zshrc
file. Follow the steps below:
-
Locate Your
.zshrc
FileThe
.zshrc
file is located in your home directory at~/Users/(your username)/
.If you don’t see it, press Shift + Command + . (dot) to toggle hidden files visibility in Finder.
-
Add ‘homebrew’ path
To ensure macOS uses the Homebrew-installed version of Python, open the
.zshrc
file with a text editor and add the following line at the start to include the homebrew path:Terminal window eval "$(/opt/homebrew/bin/brew shellenv)" -
Apply Changes
Save the
.zshrc
file and then reload it with the following command to apply changes immediately:Terminal window source ~/.zshrc -
Check Python version
Verify that the terminal is using the Homebrew-installed Python version:
Terminal window which python3The output should be something like:
Terminal window /opt/homebrew/bin/python3 -
Test the setup
Run your Python code again. It should now successfully locate the SplashKit module.
After completing these steps, your terminal will use the Homebrew-installed version of Python, and your Python script should now successfully find and run the SplashKit module without encountering the ModuleNotFoundError
.