我需要在基于 C 的应用程序中运行 Python 脚本。我可以从 Python 库中导入标准模块,即:
PyRun_SimpleString("import sys")
但是当我尝试导入本地模块时can
PyRun_SimpleString("import can")
返回错误信息:
Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named can
当我在 IPython 中键入命令import can
时,系统能够找到它。
如何将我的应用与 can 链接?我试过设置PYTHONPATH
到我的工作目录。