2015-10-17 82 views
1
当我试图在搅拌机运行我的脚本

搅拌机 - 进口大熊猫导入错误:没有模块名为熊猫

import bpy 
import pandas as pd 

datafr = pd.read_table("/Users/Admin/Desktop/Python/Programming/storage_ocp_ode.csv", delimiter = ",", index_col = 0) 
... 

我得到一个ImportError:无模块命名的大熊猫。

Traceback (most recent call last): 
File "/Users/Admin/Desktop/watertank1.blend/storageobject_flow.py", line 6, in <module> 
ImportError: No module named 'pandas' 
Error: Python script fail, look in the console for now... 

但是,当我使用命令行和进口大熊猫在那里,它的工作原理用搅拌机2.76

Python 3.4.3 |Anaconda 2.3.0 (x86_64)| (default, Mar 6 2015, 12:07:41) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import pandas 
>>> 

I'm在Mac上与OS X 10.11。

+0

如果[这个答案](http://blender.stackexchange.com/a/5289/935)没有帮助,那么[这个答案](http://blender.stackexchange.com/a/30517/935 )给出了更多细节。你可以从查看'sys.path'的建议中猜测你可以添加额外的路径来搜索。 – sambler

+0

感谢您对此的建议: 'sudo ln -s /Users/Admin/anaconda/lib/python3.4/site-packages/pandas /Applications/blender.app/Contents/Resources/2.76/scripts/模块/熊猫' 在此之后,我不得不做同样的numpy,dateutil,six.py和pytz,但现在它工作正常! – qube13

回答

2

Per the docs

The Blender releases distributed from blender.org include a complete Python installation on all platforms, this has the disadvantage that any extensions you have installed in your systems Python wont be found by Blender. (my emphasis)

There are 2 ways around this:

  • 删除搅拌机Python的子目录,然后搅拌机将在系统Python和使用回退,与其..警告:

    The Python version must match the one that Blender comes with. 
    
  • 复制扩展到Blender的Python子目录中,以便Blender可以访问它们,您还可以将整个Python安装复制到Blenders子目录中,替换一个搅拌机自带。只要Python版本匹配并且路径是在相同的相对位置创建的,就可以工作。这样做的好处是您可以使用Blender和/或游戏玩家将该套件重新分发给其他人,包括您依赖的任何扩展。

+0

谢谢你,我想你的第一个机会,现在我有这样的错误按摩: 回溯(最近通话最后一个): 文件“/Users/Retter/Desktop/watertank1.blend/storageobject_flow.py”,第6行,在 文件“/Applications/blender.app/Contents/Resources/2.76/python/lib/python3.4/site-packages/pandas/__init__.py”,第7行, from pandas import hashtable,tslib,lib File “pandas/src/numpy.pxd”,第157行,在init pandas.hashtable中(pandas/hashtable.c:38262) ValueError:numpy.dtype的大小错误,请尝试重新编译 错误:Python脚本失败,请查看控制台现在... @unutbu – qube13

+0

你有一个想法如何解决这个问题? – qube13

+0

我认为这意味着Pandas是针对NumPy的新版本进行编译的,而不是在搅拌机安装中安装的NumPy版本。请参阅http://stackoverflow.com/a/18369312/190597,https://github.com/pydata/pandas/issues/7517,http://stackoverflow.com/q/24122850/190597。 – unutbu

0

我的解决办法是符号链接:

sudo ln -s /Users/Admin/anaconda/lib/python3.4/site-packages/pandas /Applications/blender.app/Contents/Resources/2.76/scripts/modules/pandas 

此我不得不做同样的numpy的,dateutil,six.py和pytz之后,但现在它工作正常!