简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM