【问题标题】:How to add matplotlib from python3.6 to Blender?如何将 python3.6 中的 matplotlib 添加到 Blender?
【发布时间】:2017-08-14 05:49:18
【问题描述】:

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

pip install matplotlib

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

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

在 python36\lib\site-packages 中

我想在搅拌机中使用 python 中的 matplotlib 库, 我可以将Python的python36\lib\site-packages中的matplotlib复制到Blender\2.78 \python\lib\site-packages中吗?

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

我不知道如何解决它,请帮助我

非常感谢!

【问题讨论】:

标签: python matplotlib blender


【解决方案1】:

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

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

【讨论】:

  • 感谢@sambler,我使用python 3.6,不同的blender 2.78
  • @hoald,你能给我更多关于如何使用系统 python 进行搅拌机的细节吗?我删除了$PATH/blener.app/Contexts/Resources/2.78/python,并将PYTHONPATH 设置为我的系统python,比如/usr/local/python3。但在这种情况下,我无法启动搅拌机。谢谢。 (我用的是mac sierra,两个python版本都是3.5.2)
  • @Zhenjie Zhao:你试试删除Blender中的Python文件夹,复制python3文件夹替换blender/2.78/。将python3中的python35.dll复制到blender/.
猜你喜欢
  • 2018-08-15
  • 1970-01-01
  • 1970-01-01
  • 2021-11-26
  • 2011-08-31
  • 1970-01-01
  • 2017-11-24
  • 2020-09-10
  • 2018-03-03
相关资源
最近更新 更多