gpt4 book ai didi

python - 为什么 Blender 没有检测到来自 Anaconda 的 python 包?

转载 作者:行者123 更新时间:2023-12-01 04:09:20 25 4
gpt4 key购买 nike

我最近一直在使用 Blender 渲染对象的 3D 模型,并训练 SVM 来识别从某个角度拍摄的对象图片。为了训练所述 SVM,我需要使用“sklearn”,它默认随 Anaconda 一起提供。

长话短说,我希望 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 中的“python”文件夹。根据上述网站,Blender 应该回退到使用系统中安装的 python 版本(即通过 anaconda 安装的版本?对吧?),但我得到的是: enter image description here2.) 所以我进入选项 2。所以,我要做的就是转到 anaconda 文件夹并复制两个文件夹“bin”和“lib” enter image description here进入 Blender.app/Contents/Resources/2.76/python/(替换已有的 lib 和 bin 文件夹)

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

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

我很困惑,不知道如何继续。非常感谢大家的任何帮助。

最好,红先生

最佳答案

好吧,伙计们,我找到了一个解决方案,我希望这能帮助我之后的后代等等;)

无论如何,我设法通过执行以下操作来导入库:

  1. 保留 Blender 附带的所有相同文件(不要按照网站建议删除 python 文件夹!)
  2. 转到位于“Blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages”的子文件夹“site-packages”
  3. 在那里,复制以下内容“anaconda/lib/python3.4/site-packages”并将它们粘贴到前面提到的文件夹中
  4. (我复制了“anaconda/lib/python3.4/site-packages”中的所有内容,除了“numpy”和“requests”文件夹,而且我也没有复制文件“numpy-1.9.1-py3.4”。 4.egg-info”文件夹上方。)

希望这对您有所帮助,如果有帮助,不客气:)

关于python - 为什么 Blender 没有检测到来自 Anaconda 的 python 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35164666/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com