hengdin

导航

 

问题:

IDA是需要python 3 以上环境支持的,IDA 在安装后首次打开,如果检测不到本地的python 3 环境,会在下方提示未检测到python 3 环境,并提示使用 idapyswitch 命令切换 python环境。

事实上,这个 idapyswitch 是 idapyswitch.exe,就在IDA的安装目录下。

双击该exe文件没有用,弹窗一闪而过。

其实,IDA安装目录下的README_python3.txt文件已经说得比较清楚:

IDA目录运行“idapyswitch”。它将扫描Python
安装在系统的标准位置,并提供您选择一个。
它还支持可选的命令行开关来处理非标准安装。
运行`idapyswitch -h`查看它们。

解决方案一:

  1. 本地创建 PYTHONHOME 的环境变量,值为conda 的python 路径即可。(有看到博客说这种方式会导致conda环境打不开。博主自己没出现这个情况)

  2. 打开命令行:

./idapyswitch

或者:

.\idapyswitch.exe

idapyswitch 会将显示如下:

(base) PS D:\Install_path_Program\IDA9> .\idapyswitch.exe
IDA previously used: "D:\Install_path_Program\Miniconda3\python312.dll" (guessed version: 3.12.9 ('3.12.9150.1013')). Making this the preferred version.
The following Python installations were found:
    #0: 3.12.9 ('3.12.9150.1013') (D:\Install_path_Program\Miniconda3\python3.dll)
Please pick a number between 0 and 0 (default: 0)
0
Applying version 3.12.9 ('3.12.9150.1013')

选择目标python 环境对应的 数字值即可。

解决方案二:

根据 中的提示,输入 idapyswitch -h 查看对应的命令:

Usage: idapyswitch.exe [options]
-v      (--verbose) Verbose mode
-a      (--auto-apply) Run non-interactively; automatically apply the preferred version (if found)
-r      (--dry-run) Only report what would happen; don't do it
-s ...  (--force-path ...) Have IDAPython use the specified "\path\to\python3.dll" DLL

Switch between available installations of Python3

Because Python3 does not systematically install a single,
always-available "python3.dll", "libpython3.so" or "libpython3.dylib",
but rather allows for multiple versions of Python3 to be
installed in parallel on a given system, many tools
provide a way to switch between those versions.

IDA is no exception, and this tool is one such Python3 'switcher'.
Please note that the minimum supported version is Python 3.8.

It can be run in 3 ways:

1) The default, interactive way
-------------------------------
> $ idapyswitch
will look on the filesystem for available Python3 installations,
present the user with a list of found versions (sorted according
to preferability), and let the user pick which one IDA should use.

2) The 'automatic' way
----------------------
> $ idapyswitch --auto-apply
will look on the filesystem for available Python3 installations,
and automatically pick the one it deemed the most preferable.

3) The 'manual' way
-------------------
> $ idapyswitch --force-path C:\Python38\python3.dll
will use the Python library that the user provided.
Please note that specifically the path to the library is needed.
Providing the path of the interpreter executable (python.exe/python3) will not work.

Once a version is picked, this tool will place the path to the python library
into the registry, so that IDA loads the correct one at runtime.

如果 IDA 未检测到 本地python环境,或者不想创建 的环境变量,可以使用如下方式指定python 路径

./idapyswitch --force-path python路径\python3.dll

例如:

 ./idapyswitch --force-path D:\Install_path_Program\Miniconda3\python3.dll
posted on 2025-04-05 21:29  hengdin  阅读(1202)  评论(0)    收藏  举报