问题
I was trying to write a python script and execute it within blender context. But it reports 'Import Error : No module named "bpy"'. I tried installing another version of blender ( viz. 2.7.6 ) but as it appears there is actually no module named bpy inside "blender-2.76-rc2-win64\2.76\python\lib" , which is the path where python is searching for modules I suppose. I checked out the docs for blender but there is no explicit way of downloading bpy. Any help will be appreciated.
回答1:
The bpy module is a built-in part of blender that gives python scripts access to the data and operators used in blender. This module is available to scripts run within blender itself, which includes a python interpreter. The bpy module isn't normally available to import from a normal python command, but there is limited support to compile a blender module.
To use the bpy module you can start blender and use the built in python console or you can type in or open a script in the text editor which has a run script button available. Particularly if you run scripts from the text editor you will want access to a console to get error reports.
来源:https://stackoverflow.com/questions/32800927/import-error-for-bpy-module-in-python