'Python can't find Blender Module

I've built Blender as a python module on Ubuntu. Ran make install which updated the site-packages. Running python3 -m site returns the following:

sys.path = [
    '/root/blender-git/build_linux_bpy',
    ... a bunch of other paths here ...
]
USER_BASE: '/root/.local' (doesn't exist)
USER_SITE: '/root/.local/lib/python3.8/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

When I try and do a simple test.py that imports the Blender module bpy, I get a no module named 'bpy' error. Not familiar with python import rules or how to add a module, so it's no clear what I'm doing wrong. I also tried setting the sys.path explicitly but that didn't work either.



Solution 1:[1]

I'm not familiar with Linux, but Blender's Python is a unique install. The only way I've found to install 3rd party modules is to open Blender (as admin in Windows) and run the following commands:

from pip._internal import main
main(['install','pandas'])

This will install whatever 3rd party module to your python version in Blender. I hope that helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dumb Explaination