Last active
October 11, 2024 05:38
-
-
Save eeropic/5d63fe8201fb0c7d6854d174c8ed0f59 to your computer and use it in GitHub Desktop.
Install python modules to be used inside Blender (osx)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BLENDER_APP_PATH="/Applications/Blender.app" | |
if [ ! -d "$BLENDER_APP_PATH" ]; then | |
echo "Blender not found in /Applications. Please make sure Blender is installed." | |
exit 1 | |
fi | |
BLENDER_PYTHON=$(find "$BLENDER_APP_PATH" -type f -name "python3*" | head -n 1) | |
if [ -z "$BLENDER_PYTHON" ]; then | |
echo "Blender's Python not found. Please make sure you have the correct Blender installation." | |
exit 1 | |
fi | |
echo "Blender's Python found at $BLENDER_PYTHON" | |
echo "Ensuring pip is installed..." | |
$BLENDER_PYTHON -m ensurepip --upgrade | |
PACKAGE=$1 | |
if [ -z "$PACKAGE" ]; then | |
echo "No package specified. Please provide a package name as the argument." | |
echo "Usage: sh blender_pip_install.sh pythonmonkey" | |
exit 1 | |
fi | |
echo "Installing package: $PACKAGE" | |
$BLENDER_PYTHON -m pip install "$PACKAGE" | |
if $BLENDER_PYTHON -m pip show "$PACKAGE" > /dev/null 2>&1; then | |
echo "$PACKAGE successfully installed in Blender's Python environment." | |
else | |
echo "Failed to install $PACKAGE." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment