本文介绍了无法在我的python C扩展上启动dbg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用pyenv中安装的python3.6.1.我在代码上运行gdb时遇到问题.当我运行gdb --args python mycode.py时,它以错误"/home/vydra/.pyenv/shims/python": not in executable format: File format not recognized

Im using python3.6.1 installed in pyenv. I have problem with running gdb on my code. When I run gdb --args python mycode.py it ends with error "/home/vydra/.pyenv/shims/python": not in executable format: File format not recognized

推荐答案

正如Jean-FrançoisFabre所建议的那样,pyenv安装的python文件实际上是一个bash脚本.您可以使用以下命令轻松地使gdb运行此脚本:

As suggested by Jean-François Fabre, the python file installed by pyenv is actually a bash script. You can easily make gdb run this script with:

gdb -ex r --args bash python mycode.py

有关其他方法,请参见此问题:使用GDB调试从外壳程序脚本调用的C ++程序

See this question for other approaches: Use GDB to debug a C++ program called from a shell script

这篇关于无法在我的python C扩展上启动dbg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:44