I am working with choregraph to develop an application for Nao robot. I am trying to install a library that implements a speech to text functionality: it uses a simple HTTPS request. I am not able to make it work because it has a lot of dependencies and choregraph doesn't have a tool to import them properly. So my question is: how can I install any HTTPS library on choregraph without downloading every single dependency module of the library?
我正在使用choregraph开发Nao机器人的应用程序。我正在尝试安装一个实现语音到文本功能的库:它使用简单的HTTPS请求。我无法使它工作,因为它有很多依赖项,而choregraph没有一个工具来正确导入它们。所以我的问题是:如何在choregraph上安装任何HTTPS库而不下载库的每个依赖模块?
I would like to make it work also in the virtual robot.
我想让它也在虚拟机器人中工作。
1 个解决方案
#1
0
The only way to bring external Python modules is to embed them in your Choregraphe project and to append the path to those modules to the PYTHONPATH
, from inside your behavior. You will be then able to import your external modules.
引入外部Python模块的唯一方法是将它们嵌入到Choregraphe项目中,并从行为中将这些模块的路径附加到PYTHONPATH。然后,您就可以导入外部模块。
That is to say, from a Python box in your Choregraphe behavior, and according to the documentation:
也就是说,从你的Choregraphe行为的Python框中,并根据文档:
import os
import sys
sys.path.append(os.path.join(self.behaviorAbsolutePath(), 'path/to/module'))
Please note that since behaviors are running in the process of NAOqi, messing with the PYTHONPATH
may impact every behavior. So it is good to restore the path when your behavior stops.
请注意,由于行为在NAOqi的过程中运行,弄乱PYTHONPATH可能会影响每个行为。因此,当您的行为停止时恢复路径是很好的。
#1
0
The only way to bring external Python modules is to embed them in your Choregraphe project and to append the path to those modules to the PYTHONPATH
, from inside your behavior. You will be then able to import your external modules.
引入外部Python模块的唯一方法是将它们嵌入到Choregraphe项目中,并从行为中将这些模块的路径附加到PYTHONPATH。然后,您就可以导入外部模块。
That is to say, from a Python box in your Choregraphe behavior, and according to the documentation:
也就是说,从你的Choregraphe行为的Python框中,并根据文档:
import os
import sys
sys.path.append(os.path.join(self.behaviorAbsolutePath(), 'path/to/module'))
Please note that since behaviors are running in the process of NAOqi, messing with the PYTHONPATH
may impact every behavior. So it is good to restore the path when your behavior stops.
请注意,由于行为在NAOqi的过程中运行,弄乱PYTHONPATH可能会影响每个行为。因此,当您的行为停止时恢复路径是很好的。