2016-02-02 115 views
1

我最近一直在使用Blender渲染对象的3D模型,并训练SVM识别从某个角度拍摄的对象图片。为了训练所述支持向量机,我需要使用“sklearn”,它默认使用Anaconda。为什么Blender没有检测到Anaconda的python软件包?

长话短说,我想让Blender(运行Python 3.4.2)使用我的anaconda安装(运行Python 3.4.3)中的包和模块。

我已经尝试了各种东西下面这个网站: https://www.blender.org/api/blender_python_api_2_60_1/info_tips_and_tricks.html#bundled-python-extensions

1)我删除了Blender.app内的“蟒蛇”文件夹中。根据上述网站,Blender应该回退到使用安装在系统中的python版本(即通过anaconda安装的版本?对吧?),但是我得到这个: enter image description here 2)所以我进入选项2。所以,我要做的是去anaconda文件夹,并将bin和lib这两个文件夹复制到Blender.app/Contents/Resources/2.76/python/中(替换已存在的lib和bin文件夹)

到目前为止,一切都很好,我打开搅拌机(没有错误),然后我写了一个简单的脚本:

from sklearn import svm 

当我尝试运行它,我得到了以下错误消息:

Error: Python script fail, look in the console for now...

Traceback (most recent call last): File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/Scripts/MarkTwo.blend/SimulationMarkOne.py", line 5, in File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/sklearn/svm/init.py", line 13, in from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \ File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/sklearn/svm/classes.py", line 4, in from .base import _fit_liblinear, BaseSVC, BaseLibSVM File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/sklearn/svm/base.py", line 9, in from . import libsvm_sparse File "sklearn/svm/libsvm_sparse.pyx", line 5, in init sklearn.svm.libsvm_sparse (sklearn/svm/libsvm_sparse.c:7612) File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/sklearn/utils/init.py", line 16, in from .class_weight import compute_class_weight, compute_sample_weight File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/sklearn/utils/class_weight.py", line 7, in from ..utils.fixes import in1d File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/sklearn/utils/fixes.py", line 318, in from scipy.sparse.linalg import lsqr as sparse_lsqr File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/scipy/sparse/linalg/init.py", line 113, in from .matfuncs import * File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/scipy/sparse/linalg/matfuncs.py", line 20, in import scipy.misc File "/Users/cusgadmin/... Perception/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/scipy/misc/init.py", line 44, in from . import doccer ImportError: cannot import name 'doccer' Error: Python script fail, look in the console for now...

在这一点,我不知道自己还能做些什么。我用嵌在Blender的Python的控制台来探索sklearn子包和令人惊讶的我越来越不匹配的子包.. enter image description here

我很迷茫,不知道如何着手。任何帮助是非常赞赏的人。

最佳, MrRed

+0

检查我的解决方案(HTTP://搅拌机。 stackexchange.com/a/51800/24252)。 – su79eu7k

回答

2

好的人,我找到了一个解决方案,我希望这将有助于后代后我等;)

不管怎样,我总算能够通过导入库执行以下操作:

  1. 保留所有搅拌机带着相同的文件
  2. 转到位于子文件夹“站点包”(如网站建议不要删除蟒蛇文件夹!) :“Blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages”
  3. 在那里,复制 “anaconda/lib/python3.4/site-packages”的内容并粘贴它们在前面提到的文件夹
  4. (我复制了“anaconda/lib/python3.4/site-packages”中除“numpy”和“requests”文件夹以外的所有内容,并且我也没有复制文件“numpy-1.9 .1-py3.4.egg-信息”的文件夹上)

希望这会有所帮助,如果确实如此,欢迎您:)

相关问题