blenderings/create_venv.bash

29 lines
761 B
Bash
Raw Normal View History

2022-01-09 10:01:10 -07:00
#!/usr/bin/env bash
if ! [[ -f .env ]]; then
echo "Add a .env file with PYTHON_PATH containing an absolute path path to"
echo "blender's python build with bpy. "
echo "E.g PYTHON_PATH=~/blender-git/lib/linux_centos7_x86_64/python/bin/python3.9"
echo "PYTHON_PATH=~/blender-git/lib/linux_centos7_x86_64/python/bin/python3.9" > .env
2022-01-10 00:14:20 -07:00
echo "VIRTUAL_ENV_DISABLE_PROMPT=YESPLEASE" >> .env
2022-01-09 10:01:10 -07:00
echo "Created the file. Now go edit it"
exit 1;
fi
source .env
2022-01-10 00:14:20 -07:00
if [[ -d venv ]]; then
source ./venv/bin/activate
return
exit 0
fi
2022-01-09 10:01:10 -07:00
if [[ -z "$PYTHON_PATH" ]]; then
echo Missing variable PYTHON_PATH in .env
exit 1
fi
"$PYTHON_PATH" -m venv --system-site-packages --symlinks venv
echo "venv created"
source ./venv/bin/activate