我在choregraphe中编写了一个块代码,我需要在numpy和pillow库中使用一些函数。我使用pip将枕头和numpy安装在相同的行为文件夹中。在choregraphe里面我尝试了块代码:
from sys import path
path.append(ALFrameManager.getBehaviorPath(self.behaviorId))
from PIL import Image
from scipy import array, inf
from scipy.sparse.csgraph import shortest_path, csgraph_from_dense
我收到此错误:
ImportError: cannot import name _imaging
如果我评论该行
from PIL import Image
我收到此错误:
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: cannot import name multiarray
我尝试重新安装这两个库,但没有任何改变。我哪里错了?在同一个文件夹中还有一个我写的类,但没有导入它的问题,我不明白为什么
答案 0 :(得分:0)
您是在机器人(哪一个?哪个操作系统版本?)或计算机本地运行?
如果它在机器人上,那么包中包含的库的.so文件(和其他二进制文件)可能不会针对正确的体系结构进行编译。
一些可能性:
pip install --user --upgrade pip
然后
/home/nao/.local/bin/pip install --user scipy (or whatever other package you need)
然后您不需要将这些文件打包到您的choregraphe包中(但是您必须对要安装它的所有机器人执行相同的操作,这可能适用于您的用例,也可能不适合您的用例