From BlenderWiki

Jump to: navigation, search

This is an experimental option to be able to import blender into python and access its modules, importers, exporters rendering, video editing... etc.

This is mainly limited to features which can be usable in background mode, so you cant for instance do OpenGL preview renders.


assuming you have a CMake out-of-source build setup, see:

OSX prerequisites: get Python3.3-Framework from and install it.

Change these CMake options from the defaults:


Now build blender normally with 'make install'

Everything should build as normal except in the cmake directory you will have ./bin/ rather then ./bin/blender



To make this available for python copy these files to your site-packages by running

make install

Or if you like to do it manually

cp ./bin/ /usr/lib/python3.3/site-packages/
cp --recursive ./bin/2.65 /usr/lib/python3.3/site-packages/


copy bin\bpy.pyd C:\Python33\Lib\site-packages\
copy bin\*.dll C:\Python33\Lib\site-packages\
del C:\Python32\Lib\site-packages\python33.dll
xcopy /E bin\2.65 C:\Python33\


After compiling and "make install", copy needed files to your python framework

cp ./bin/ /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
cp -R ./bin/2.65 /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/

Note. Unlike on *nix C:\Python33\2.65 is not in the site packages, this is because of a difference in how Windows finds the scripts path and should eventually be fixed.


This allows 'bpy' to be imported from python or other applications/IDE's which embed python, eg:

python -c "import bpy ; bpy.ops.render.render(write_still=True)"

This runs in background mode and has similar restrictions to running a script:

blender --background --python


  • The Python version requirements are the same with building a regular blender binary (if Blender us using Python3.3 then there is NO WAY to use another version - 2.7/3.2/3.4 will all fail).
  • On Windows, you probably won't want to use a debug build, since this requires a debug python installation (python33_d.dll rather then python33.dll), so while it can be made to work, its more trouble.