2
$\begingroup$

How can you install packages into blender's python a makefile? I want to be able to run a "make python-deps" and have it automatically install a list of dependencies

$\endgroup$
2
$\begingroup$

The solution is to have a makefile target that installs pip using the specific blender python version.

PYTHON_DEPS = \
    pyyaml \
    pillow \
    scipy

# Change these as needed
BLENDER_BIN_DIR = ~/bin/src/blender/build_linux/bin
BLENDER_VERSION = 2.78

# With luck you shouldn't need to touch these
PYTHON_PACKAGE_DIR = $(BLENDER_BIN_DIR)/$(BLENDER_VERSION)/python/local/lib/python3.5/dist-packages/
PYTHON3 = $(BLENDER_BIN_DIR)/$(BLENDER_VERSION)/python/bin/python3.5m


python-deps:
    # Install pip
    wget -nc https://bootstrap.pypa.io/get-pip.py
    $(PYTHON3) get-pip.py

    # Install dependencies
    $(PYTHON3) $(PYTHON_PACKAGE_DIR)/pip install $(PYTHON_DEPS)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.