[英]How to use blender through VSCode with python for integrating 2D widgets with 3D models
我是 Blender 社区的新手,并通过代码为 model 事物创建了一些附加组件..
However, I am failing to execute the same code through my IDE , IDLE and VS Code with all my paths set for Python 3.7.0 installed inside python folder of Blender 2.80 directory in C drive (cant use other version for VS Code as Blender extension在 VS Code 中仅支持 python 3.7.0 和相同的 Python 版本仅与 Blender 2.80 兼容)
但是,我已经在另一个驱动器上安装了最新版本的 Python(3.9.1)和 Blender(2.93 Alpha)。在那里,我手动安装了最新版本的 Python,就像我安装的那个一样
所以,我在以下两个位置有我的 python 解释器
C:\Program Files\Blender Foundation\Blender\2.80\python\python.exe
D:\软件\UPBGE\2.93\python\python.exe
问题如下:
当我通过命令“ py --version ”检查 python 版本时,即使在 VS Code 中选择解释器歧义的解释器选择为 3.7.0,它也会显示 3.9.1
Whenever I install any pypi module through cmd, it installs the module to older version, ie, 3.7.0 directory in C drive even when python 3.9.1 interpreter selected Blender stores its built in python interpreter inside bin directory inside python folder
每当我尝试运行任何导入 bpy 内容的脚本时,它都会说bpy模块不存在找不到名为bpy-types的模块
将 python 库安装到搅拌机的 python 环境中。
<[Blender Python.exe 路径]> -m pip install <[包名]>
例如,在您的 UPBGE 情况下:
D:\Softwares\UPBGE\2.93\python\python.exe -m pip install <[Package Name]>
如果命令失败,您可能需要在 python 环境中添加“pip”: https://bootstrap.pypa.io/get-pip.py
要运行使用 bpy 的脚本,您还需要使用 Blenders python。
<[Blender Python.exe 路径]> <[脚本路径]>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.