当前位置: 首页 > 工具软件 > McSema > 使用案例 >

mcsema ida库引用

齐招
2023-12-01

mcsema中python文件是放在/usr/local/lib/python2.7/dist-packages/mcsema_disass-2.0-py2.7.egg/mcsema_disass/目录下,所以一些ida接口也在/usr/local/lib/python2.7/dist-packages/mcsema_disass-2.0-py2.7.egg/mcsema_disass/下,在普通目录下引用ida不成功

linux环境下 python环境import找不到自定义的模块

问题现象:

Linux环境中自定义的模块ida,import ida出错。ida模块在/usr/local/lib/python2.7/dist-packages/mcsema_disass-2.0-py2.7.egg/mcsema_disass/目录下。

解决方法1:此种办法当时生效,但是需要写入每一个文件中,才能import不出错。

import sys
sys.path.append('export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages/mcsema_disass-2.0-py2.7.egg/mcsema_disass/')
import ida
import ida7
#成功

解决方法2:修改环境变量/etc/profile

vi /etc/profile  在最后一行添加

export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages/mcsema_disass-2.0-py2.7.egg/mcsema_disass/

source /etc/profile 立即生效,所有文件都可以引入/usr/local/lib/python2.7/dist-packages/mcsema_disass-2.0-py2.7.egg/mcsema_disass/下的模块。

 类似资料: