Make used Python path available to the BGE
Closed, ArchivedPublic

Description

System Information
Windows 10

Blender Version
2.78c

Short description
The Python interpreter path should be made available to the bge module.
Currently on Windows to get the currently-used Python path we would use sys.executable, but this line returns the Blender executable, not Python's...

The bpy module does provide the path, but its not usable from the BGE (think about a standalone).

Fix
Similarly to bpy.app.binary_path_python, have an bge.app.binary_path_python available.

Details

Type
Bug

when you are installing modules into blender, you must install them into blender/python

there was talk of pip install working inside blender, but I have had issues with it.

standalone module will have it's own python interpreter, which will need the same libs.

when you are installing modules into blender, you must install them into blender/python

there was talk of pip install working inside blender, but I have had issues with it.

standalone module will have it's own python interpreter, which will need the same libs.

Pip does works flawlessly with Blender, as there is some ensurepip module bootstrapping pip for the Python installation packed with Blender. More.

But for some test project I had to register the Python executable path from a BGE runtime (read: from a running game), but was unable to retrieve the Python executable path.

Although I do not understand the point of mentioning pip, which does works, the problem is that we can get access to the Python's path from bpy, but not from bge.

you mean bge.logic.expandPath(path) ?

https://docs.blender.org/api/blender_python_api_2_70_5/bge.logic.html#bge.logic.expandPath

edit: try and pip install and import pyttsx or tensor flow

pip install pyttsx3 for Blender's Python 3.5.x is working correctly... Make sure to have admin rights if you're installing libs in your "C:\Program Files" directory... Won't test for tensorflow, as it is not the problem (it will work for sure, given you type the right commands)

Edit: tested for tensorflow just in case: it worked.

bge.logic.expandPath converts a path. It is not the problem: What should be interesting would be something like bge.app.binary_path_python returning, say: C:\Program Files\Blender Foundation\Blender\2.78\python\bin\python.exe. or any other location depending on the OS.

Sergey Sharybin (sergey) closed this task as Archived.Sep 14 2017, 3:21 PM
Sergey Sharybin (sergey) claimed this task.

Thanks for the report, but it's more a feature request than a bug which we don't accept in the bug tracker. Such requests better be addressed to bf-funboard (general functional discussion board) or bf-gamedev (BGE related discussions) mailing lists.

Thanks, didn't know where to address !