Blender player is a nice way to create stand alone .blend files that can be distributed to other people.
However, for most interesting programming, one would use in python libraries such as numpy, etc. All the python libraries out there is what makes python so powerful. Blender does not come with e.g. numpy pre-installed, .but 3rd party libraries can be installed.
However, when the .blend file is distributed, it still depends on those libraries... The problem is that now the end-user, which might not be tech-savvy needs to install the 3rd party libraries alone... Is there any way to fix this?
This question relates to the (unanswered :S) How to bundle python libraries into addon? in that a solution to it might be a solution to this one, but "how-to-bundle-python-libraries-into-addon" refers to plugins, not .blends for the standalone player, and further this question is more general, any way to distribute the 3rd-party libraries would be ok (e.g. could one put them in the .blend directory and set some paths to point there?).
I had the problem on a .blend file, and that was because I was using an old version of Blender , newer versions will have numpy etc. (my old version was using the system's python, now python comes with a nice python that has common stuff like numpy included, so the question becomes less important.
To see if numpy was not there i did on a script from inside blender:
import os import sys print ('sys.executable',sys.executable) print ('---') print ('sys.path',sys.path) print ('===') try: print ('PYTHONPATH', os.environ['PYTHONPATH']) except: print ('no PYTHONPATH') import numpy as np print('done!:)')
to which I got:
sys.executable /usr/bin/blender --- sys.path ['/usr/share/blender/scripts/addons', '/usr/share/blender/scripts/startup', '/usr/share/blender/scripts/modules', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/share/blender/scripts/freestyle/modules', '/usr/share/blender/scripts/addons/modules', '/home/ntg/.config/blender/2.76/scripts/addons/modules'] === no PYTHONPATH Traceback (most recent call last): File "/Text", line 11, in <module> ImportError: No module named 'numpy' Error: Python script fail, look in the console for now...
Blender 2.79 gives:
sys.executable /home/ntg/software/blender-2.79-linux-glibc219-x86_64/blender --- sys.path: /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/scripts/addons_contrib /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/scripts/addons /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/scripts/startup /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/scripts/modules /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/python/lib/python35.zip /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/python/lib/python3.5 /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/python/lib/python3.5/plat-linux /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/python/lib/python3.5/lib-dynload /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/scripts/freestyle/modules /home/ntg/software/blender-2.79-linux-glibc219-x86_64/2.79/scripts/addons/modules /home/ntg/.config/blender/2.79/scripts/addons/modules === os.path: /opt/pub/anaconda2/bin:/home/ntg/bin:/home/ntg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games === no PYTHONPATH done!:)