I'd like to run Blender from the command line (like this) in Mac OS, but am running into an error which causes Blender to crash each time I run ./blender
(from within /Applications/Blender/blender.app/Contents/MacOS):
Jamies-MBP:MacOS Jamie$ ./blender
ndof: 3Dx driver not found
Read new prefs: /Users/Jamie/Library/Application Support/Blender/2.74/config/userpref.blend
found bundled python: /Applications/Blender/blender.app/Contents/MacOS/../Resources/2.74/python
Fatal Python error: Py_Initialize: unable to load the file system codec
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Illegal instruction: 4
The OS also reports that 'Blender quit unexpectedly.'
The error seems to suggest that Blender is looking for Python 2.7, but I thought Blender would always use its own copy of Python 3? If I run which python
I get /usr/bin/python
, and if I run which python3
I get /Library/Frameworks/Python.framework/Versions/3.5/bin/python3
.
If I run $PYTHONPATH
the output looks like this:
-bash: /Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC:
/Library/Python/2.7/site-packages:
/Library/Python/2.7/site-packages/PIL: No such file or directory
I'm not sure whether this is typical or not (there seems to be an No such file or directory error but I don't know if that's related).
What should I do to fix this or investigate this further? Do I need to add python3 to my $PYTHONPATH
? This answer mentions other variables, such as $BLENDER_SYSTEM_PYTHON
– do I need to change this?