如何将 matplotlib 从 python3.6 添加到 Blender?

How to add matplotlib from python3.6 to Blender?

在Window中,我安装了python3.6 并且,通过命令行安装了 matplotlib:

pip install matplotlib

安装后,我在python控制台中运行matplotlib,

import matplotlib.pyplot as plt
import matplotlib.pylab as plb

在python36\lib\site-packages

我想在 blender 中使用 python 中的 matplotlib 库, 我可以将 Python 的 python36\lib\site-packages 中的 matplotlib 复制到 Blender.78 \python\lib\site-packages 中吗?

我尝试复制但只导入了matplotlib,但是当`import matplotlib.pylot as plt时错误如下

我不知道怎么解决,请帮帮我

非常感谢!

首先,您需要确保使用与构建 blender 时相同的 python 版本,对于 blender 2.78,即 python 3.5。对于像 matplotlib 这样的编译 python 模块,这比纯 python 模块更重要。

使用第三方模块的方法很少,首先就像您尝试的那样,将它们安装到 blender 的 python 副本中。另一种方法是删除 blender 的 python 以便它使用系统安装的版本。您还可以调整 sys.path 以允许 blender 的 python 查找第三方模块。