使用 *.desktop 快捷方式启动 python 程序

使用 *.desktop 快捷方式启动 python 程序

我希望能够通过单击桌面上的图标来启动 Python 程序。该程序使用 NVIDIA 的 pycuda 和 NVCC 编译器。我创建了以下桌面文件

[Desktop Entry]
Type=Application
Terminal=true
Name=Trial4
Icon=utilities-terminal
Exec=/home/mantis/Desktop/trial4.sh 2>~/Desktop/trial4.log
#Exec=python3 /home/mantis/Desktop/sandpit/Trial4.py 2>~/Desktop/trial4.log
Categories=Application;

Exec 命令在命令提示符下运行良好,但是当我尝试运行桌面文件时,错误日志中出现以下信息:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pytools-2019.1.1-py3.6.egg/pytools/prefork.py", line 50, in call_capture_output
    stderr=PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'nvcc': 'nvcc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mantis/Desktop/sandpit/Trial4.py", line 23, in <module>
    import sigpack_v2 as sp2
  File "/home/mantis/Desktop/sandpit/sigpack_v2.py", line 276, in <module>
    """)
  File "/usr/local/lib/python3.6/dist-packages/pycuda-2019.1.2-py3.6-linux-aarch64.egg/pycuda/compiler.py", line 291, in __init__
    arch, code, cache_dir, include_dirs)
  File "/usr/local/lib/python3.6/dist-packages/pycuda-2019.1.2-py3.6-linux-aarch64.egg/pycuda/compiler.py", line 254, in compile
    return compile_plain(source, options, keep, nvcc, cache_dir, target)
  File "/usr/local/lib/python3.6/dist-packages/pycuda-2019.1.2-py3.6-linux-aarch64.egg/pycuda/compiler.py", line 78, in compile_plain
    checksum.update(preprocess_source(source, options, nvcc).encode("utf-8"))
  File "/usr/local/lib/python3.6/dist-packages/pycuda-2019.1.2-py3.6-linux-aarch64.egg/pycuda/compiler.py", line 50, in preprocess_source
    result, stdout, stderr = call_capture_output(cmdline, error_on_nonzero=False)
  File "/usr/local/lib/python3.6/dist-packages/pytools-2019.1.1-py3.6.egg/pytools/prefork.py", line 227, in call_capture_output
    return forker.call_capture_output(cmdline, cwd, error_on_nonzero)
  File "/usr/local/lib/python3.6/dist-packages/pytools-2019.1.1-py3.6.egg/pytools/prefork.py", line 61, in call_capture_output
    % (" ".join(cmdline), e))
pytools.prefork.ExecError: error invoking 'nvcc --preprocess -arch sm_53 -I/usr/local/lib/python3.6/dist-packages/pycuda-2019.1.2-py3.6-linux-aarch64.egg/pycuda/cuda /tmp/tmputmjhvkh.cu --compiler-options -P': [Errno 2] No such file or directory: 'nvcc': 'nvcc'

有人能告诉我问题出在哪里吗?

相关内容