在这里作者在17.20-17.50提到,未来可以使用标准Python解释器访问BPY。它已经有1年历史了,那么我如何在标准的Python控制台中访问BPY呢?
试验0:绕路解决方案无法在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
test.py
,但失败了吗? - jdi