如何在Python中导入Blender模块时修复错误

时间:2018-11-06 07:17:01

标签: python blender

当我将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: ***

1 个答案:

答案 0 :(得分:0)

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

只需进入python env,进入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