Installing a module on Choregraphe

喜你入骨 提交于 2020-01-24 23:58:25

问题


I am trying to install a python module to use in Choregraphe. For windows this does not appear to be an issue. All I have to do is make sure that the module is installed in Python on the operating system.

For OSX, it does not appear to recognise the module. I have also tried importing it as a folder to a project, but it still can't see it.


回答1:


Do you try playing with the python system path: the location when he looks for library.

Like that (in your choregraphe box):

import sys
sys.path.append("path containing your_module folder")
import your_module



回答2:


From the linked site:

1. Download python scripts of Requests and its dependencies from github.

2. Copy these scripts into my Project content(I made 'lib' directory in the project and copied all scripts into the folder)

3. Add the following code to import the modules

import sys, os
framemanager = ALProxy("ALFrameManager")
folderName = os.path.join(framemanager.getBehaviorPath(self.behaviorId), "../lib")
if folderName not in sys.path:
    sys.path.append(folderName)
import requests

4. Add the following to unload the modules

import sys
if self.folderName and folderName in sys.path:
    sys.path.remove(folderName)


来源:https://stackoverflow.com/questions/46439607/installing-a-module-on-choregraphe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!