【发布时间】:2017-05-24 10:27:55
【问题描述】:
我是 Python 新手。我试图像这样(在 Raspberry Pi 中)从 c++ 调用 python 脚本。
std::string pythonCommand = "python Callee.py \""+a+"\" "+b;
int res = system(pythonCommand.c_str());
运行后我得到了这个。
python: can't open file 'Callee.py': [Errno 2] No such file or directory
但是我可以使用命令行成功运行 Callee.py 并且两个文件都存储在同一个目录中。
我错过了什么?
【问题讨论】:
-
证明路径对我有用
-
链接python并使用本机解释器而不是通过系统不是更好吗?
-
我不知道该怎么做,我是 python 的新手。
标签: python c++ raspberry-pi