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:
/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?


Well the solution for me was to unset my $PYTHONPATH, which was configured to create the output listed above by a line in my ~/.bash_profile file.

When started from the Terminal, Blender now still loads the bundled Python:

found bundled python: /Applications/Blender/blender.app/Contents/MacOS/../Resources/2.74/python

But Python is now able to load the modules it needs. I guess that having $PYTHONPATH set was preventing Blender's Python from being able to load required modules.

  • $\begingroup$ I had a similar problem, but Python 2.7 path wasn't in my PYTHONPATH , but in in my PATH environnement variable. Thank you for pointing me the right .. path :P $\endgroup$ – Technico.top Jun 29 '18 at 8:40

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.