安装 Blender module
- 确定Blender使用的python版本
1 2 3
import sys print(sys.version) # 3.9.7 (default, Oct 11 2021, 19:31:28) [MSC v.1916 64 bit (AMD64)]
- 在conda中安装新的环境
1
conda create --name blender python=3.9.7 pandas numpy
- 在新环境中定位python路径
1 2
import sys; print(sys.path) # ['D:\\software\\miniconda\\envs\\blender\\python397.zip', 'D:\\software\\miniconda\\envs\\blender\\DLLs', 'D:\\software\\miniconda\\envs\\blender\\lib', 'D:\\software\\miniconda\\envs\\blender', '', 'D:\\software\\miniconda\\envs\\blender\\lib\\site-packages', 'D:\\software\\miniconda\\envs\\blender\\lib\\site-packages\\win32', 'D:\\software\\miniconda\\envs\\blender\\lib\\site-packages\\win32\\lib', 'D:\\software\\miniconda\\envs\\blender\\lib\\site-packages\\Pythonwin', 'C:\\Users\\brain\\AppData\\Roaming\\Python\\Python397\\site-packages']
- 找到
site-packages字样的路径添加到Blender的python中1 2
import sys sys.path.append('D:\\software\\miniconda\\envs\\py310\\lib\\site-packages')
或者
- 定位Blender使用的python路径
1 2 3
import sys print(sys.path) # ['D:\\software\\Blender\\3.0\\scripts\\startup', 'D:\\software\\Blender\\3.0\\scripts\\modules', 'D:\\software\\Blender\\python39.zip', 'D:\\software\\Blender\\3.0\\python\\DLLs', 'D:\\software\\Blender\\3.0\\python\\lib', 'D:\\software\\Blender\\3.0\\python\\bin', 'D:\\software\\Blender\\3.0\\python', 'D:\\software\\Blender\\3.0\\python\\lib\\site-packages', 'D:\\software\\Blender\\3.0\\scripts\\freestyle\\modules', 'D:\\software\\Blender\\3.0\\scripts\\addons\\modules', 'C:\\Users\\brain\\AppData\\Roaming\\Blender Foundation\\Blender\\3.0\\scripts\\addons\\modules', 'D:\\software\\Blender\\3.0\\scripts\\addons', 'D:\\software\\Blender\\3.0\\scripts\\addons_contrib']
- 找到python位置后用pip安装新包
1 2
D:\software\Blender\3.0\python\bin\python -Im pip install --upgrade pip D:\software\Blender\3.0\python\bin\python -Im pip install pandas
本文由作者按照 CC BY 4.0 进行授权