gpt4 book ai didi

c++ - Qt Creator 拒绝将自定义 python 程序作为构建步骤命令执行

转载 作者:太空宇宙 更新时间:2023-11-04 11:29:16 27 4
gpt4 key购买 nike

我正在编写一个共享库,为了更新我的 /usr/include 目录中的头文件,我编写了一个 python 程序来比较和保留源目录中的头文件在 /usr/include 目录中更新,希望当我将它们与我的测试可执行文件链接时,在每个构建的 header 中自动完成。

问题是Qt Creator无法执行python程序。我的设置如下:

Command : 'python'
Working Directory : '/path/to/python/file'
Args : 'PythonFile.py'

是的,已选中启用自定义流程步骤框。

我的输出类似于以下内容:

无法启动进程“python”PythonFile.py

诚然,如果有另一种更简单的方法来解决这个 header 问题(并且包括自动完成更新的能力),我会洗耳恭听。

编辑

我还应该说我已经通过 CLI 执行了该程序并且它工作正常。

更新

根据 Slava 的建议更新命令,我得到以下输出:

Program is beginning
Traceback (most recent call last):
File "UpdateHeaders.py", line 59, in <module>
PROJECT_ROOT = environ['ATLAS_PROJ_ROOT']
File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'ATLAS_PROJ_ROOT'
13:08:35: The process "/usr/bin/env" exited with code 1.

但是,如果我通过 CLI 运行它,我会得到:

Program is beginning
Updating include directory on a UNIX based system, copying files from /home/amsterdam/Programming/atlas/Engine/AtlasEngine/ to /usr/include/atlas/Engine/
Found a source count of 5;
Found a dest count of 0
No headers have been copied to "/usr/include/atlas/Engine/", yet; copying now from "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/"
Iterating through ['AtlasEngine.pro', 'GameObject.hpp', 'AtlasEngine_global.h', 'Type_Config.hpp', 'Rectangle.hpp', 'AtlasEngine.pro.user', 'Engine.hpp', 'Engine.cpp']
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/GameObject.hpp" to "/usr/include/atlas/Engine/GameObject.hpp"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/AtlasEngine_global.h" to "/usr/include/atlas/Engine/AtlasEngine_global.h"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/Type_Config.hpp" to "/usr/include/atlas/Engine/Type_Config.hpp"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/Rectangle.hpp" to "/usr/include/atlas/Engine/Rectangle.hpp"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/Engine.hpp" to "/usr/include/atlas/Engine/Engine.hpp"

如图所示,除非通过 Qt Creator 运行,否则一切正常,没有任何错误。有什么建议吗?

最佳答案

命令:'/usr/bin/env'
工作目录:'/path/to/python/file'
参数:'python PythonFile.py'


命令:'/usr/bin/env'
参数:'python/path/to/python/file/PythonFile.py'

关于c++ - Qt Creator 拒绝将自定义 python 程序作为构建步骤命令执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12344428/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com