简体   繁体   English

Python 找不到搅拌机模块

[英]Python can't find Blender Module

I've built Blender as a python module on Ubuntu. Ran make install which updated the site-packages.我在 Ubuntu 上将Blender构建为 python 模块。运行更新站点包的make install Running python3 -m site returns the following:运行python3 -m site返回以下内容:

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.当我尝试做一个导入 Blender 模块bpy的简单test.py时,我得到一个no module named 'bpy'错误。 Not familiar with python import rules or how to add a module, so it's no clear what I'm doing wrong.不熟悉 python 导入规则或如何添加模块,所以不清楚我做错了什么。 I also tried setting the sys.path explicitly but that didn't work either.我还尝试显式设置 sys.path,但这也不起作用。

I'm not familiar with Linux, but Blender's Python is a unique install.我不熟悉 Linux,但 Blender 的 Python 是一个独特的安装。 The only way I've found to install 3rd party modules is to open Blender (as admin in Windows) and run the following commands:我发现安装第 3 方模块的唯一方法是打开 Blender(在 Windows 中以管理员身份)并运行以下命令:

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

This will install whatever 3rd party module to your python version in Blender.这会将任何第 3 方模块安装到 Blender 中的 python 版本。 I hope that helps.我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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