【发布时间】:2021-08-09 15:20:20
【问题描述】:
我正在尝试在 Ubuntu 上通过 C++ 使用系统调用来启动 Python 脚本。问题是这个命令有时会起作用,但通常情况下,它会失败并抛出以下两个错误之一:
sh: 1: Syntax error: EOF in backquote substitution
sh: 1: xK-��: not found
我正在使用的代码:
std::string pythonPath = "/home/myuser/Programs/miniconda3/envs/Py37/bin/python3.7";
std::string viewerScript = "/home/myuser/Projects/Pycharm/MyProject/script.py";
std::string command = pythonPath + " " + viewerScript;
std::thread* t = new std::thread(system, command.c_str());
知道这里发生了什么吗?
【问题讨论】:
标签: python c++ bash ubuntu system