【问题标题】:How to fix error when importing the blender module in Python在 Python 中导入搅拌机模块时如何修复错误
【发布时间】:2019-04-09 13:50:16
【问题描述】:

当我将 bpy 导入 python 时,我得到以下错误代码,这是因为我需要安装搅拌机,或者我可以用另一种方式解决这个问题'

Color management: using fallback mode for management
BLT_lang_init: 'locale' data path for translations not found, continuing
AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead
bpy: couldnt find 'scripts/modules', blender probably wont start.
Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): c:\users\tgubs\.blenderpy\blender\source\blender\python\intern\bpy_rna.c:6662 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): c:\users\tgubs\.blenderpy\blender\source\blender\python\intern\bpy_rna.c:6662 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): c:\users\tgubs\.blenderpy\blender\source\blender\python\intern\bpy_rna.c:6662 pyrna_srna_ExternalType: failed to find 'bpy_types' module
F1106 16:58:18.372622 23956 utilities.cc:322] Check failed: !IsGoogleLoggingInitialized() You called InitGoogleLogging() twice!
*** Check failure stack trace: ***

【问题讨论】:

  • Blender 包含并使用它自己的 python 解释器。通常,blender 被告知直接运行其脚本,无论是在 GUI 中还是在后台使用来自 the CLIblender --background --python script.pybuild blender as a python module 可以在标准的python解释器中导入。

标签: python blender


【解决方案1】:

您需要将2.79 文件夹移动到包含python 可执行文件的目录。

只需进入您的 python 环境,进入 Scripts 目录,从那里剪切 2.79 文件夹并将其粘贴到包含 Conda Python 可执行文件的文件夹中。问题是版本文件夹(当前为2.79)必须与 Python 可执行文件同级。由于您所处的任何环境都没有位于脚本旁边的python.exe 文件(pipvenv 等),因此它会抱怨因为bpy_types 的路径应该是./2.79/scripts/modules/bpy_types.py(相对于当前 python.exe 正在尝试导入它)但找不到它。

Windows 是一个已知平台,其中这些脚本文件可能会有所不同,尤其是取决于您的环境。

简而言之:

找到文件夹2.79 从当前位置剪切它 将其粘贴到包含python.exe的文件夹中

请看this issue

【讨论】:

    猜你喜欢
    • 2012-06-25
    • 2016-01-29
    • 2013-01-17
    • 2014-06-29
    • 2019-12-22
    • 2015-08-24
    • 1970-01-01
    • 2017-04-18
    • 1970-01-01
    相关资源
    最近更新 更多