作者在17.20-17.50 点中提到,将来您可以使用标准 Python 解释器访问 BPY。它已经 1 岁了,那么如何使用标准 python 控制台访问 BPY?
试用 0:roundaround -解决方案不适用于 Blender 中的子进程
subprocess.call(['vim', 'test.py']) # some editing of BPY -file with Vim (not working currently) subprocess.call(['python', 'test.py']) # trying to execute the python -file (not working currently)
试验 1:不在 Blender 之外工作
$ cat cubes.py import bpy mylayers = [False]*20 mylayers[0] = True add_cube = bpy.ops.mesh.primitive_cube_add for index in range(0, 5): add_cube(location=(index*3, 0, 0), layers=mylayers) $ python cubes.py Traceback (most recent call last): File "cubes.py", line 1, in <module> import bpy ImportError: No module named bpy