gpt4 book ai didi

python - GDB pretty-print : Python Exception no codec search functions registered: can't find encoding

转载 作者:太空宇宙 更新时间:2023-11-03 17:54:05 25 4
gpt4 key购买 nike

我尝试使用gdb为STL设置 pretty-print : http://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/并按照说明运行

并按照以下说明修复了 python 的问题: GDB pretty printing ImportError: No module named 'printers'

现在,获取gdbinit 文件 时没有错误。

但在尝试打印 multiMap 时,我遇到了以下错误:

(gdb) p mymMap

Python Exception <type 'exceptions.LookupError'> no codec search functions registered: can't find encoding:

Python Exception <type 'exceptions.LookupError'> no codec search functions registered: can't find encoding:

$1 =

关于如何解决这个问题有任何提示吗?

1)在 gdbinit 中遵循 stmt 之前尝试添加导入编解码器:

from libstdcxx.v6.printers import register_libstdcxx_printers

2) python 安装中存在编解码器模块

version info:
gdb version - 7.5.1;
python in gdb - 2.6.5

最佳答案

我能够让它发挥作用。我的应用程序同时使用 c++ 和 python。因此,我的环境始终包含 PYTHONHOME/PATH 设置,该设置与用于安装 gdb 的 python 版本不同。我用完全相同的 python 重新安装了 gdb,现在工作正常。谢谢你的提示,汤姆。

关于python - GDB pretty-print : Python Exception <type 'exceptions.LookupError' > no codec search functions registered: can't find encoding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28745346/

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