如何在Python中导入Blender模块时修复错误
当我将bpy导入python时,我得到以下错误代码,这是因为我需要安装搅拌器,或者我可以用其他方法解决此问题吗?
i get the following error code when i import bpy into python is this because i need blender installed or can i solve this probelm another way'
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: ***
您需要将2.79
文件夹移至包含python可执行文件的目录.
You need to move the 2.79
folder to the directory containing the python executable.
只需进入python env,进入Scripts目录,从其中剪切2.79
文件夹,然后将其粘贴到包含Conda Python可执行文件的文件夹中.问题在于版本文件夹(当前为2.79
)必须与Python可执行文件同级.由于您所处的环境都没有在脚本旁边放置python.exe
文件(pip
,venv
等),因此会抱怨,因为到bpy_types
的路径应该是./2.79/scripts/modules/bpy_types.py
(相对于当前正在尝试导入的python.exe
),但找不到它.
simply go into your python env, into the Scripts directory, cut the 2.79
folder out of there and paste it into the folder containing the Conda Python executable. The problem is that the version folder (2.79
, currently) must be sibling to the Python executable. Since whatever environment you are in does not have the python.exe
file located alongside the Scripts (pip
, venv
, etc) it is complaining since the path to bpy_types
is supposed to be ./2.79/scripts/modules/bpy_types.py
(relative to the current python.exe
that is trying to import it) and it can't find it.
Windows是一个已知平台,这些脚本文件可能会有所不同,尤其是取决于您的环境.
Windows is a known platform where these script files can be different, especially depending on your environment.
简而言之:
找到文件夹2.79
从当前位置剪切
将其粘贴到包含python.exe
Find the folder 2.79
Cut it from the current location
Paste it into the folder containing python.exe
请参见此问题