---
title: 执行命令
description: "1. 下载Python相关软件包，而所有依赖都在“/data/ann-benchmarks-main/requirements.txt”中，下载依赖命令如下："
url: https://www.hikunpeng.com/document/detail/zh/kunpengdbs/testguide/tstg/kunpeng_ann_marks_012.html
sourcePath: /source/zh/kunpengdbs/testguide/tstg/kunpeng_ann_marks_012.html
indexId: 5f56aa2e6150bcaf47faf14cfa853a0c33e6e0534d0488d4b3c010df73fbeb9e63
---
# 执行命令

1. 下载Python相关软件包，而所有依赖都在“/data/ann-benchmarks-main/requirements.txt”中，下载依赖命令如下：

```
pip install -r requirements.txt
```


2. 可选：为了防止创建索引时间过长，可以在“milvus/module.py”的create_index函数中指定超时参数timeout。

  a. 打开文件。
    1 /data/ann-benchmarks-main/ann_benchmarks/algorithms/milvus/module.py

  b. 按“i”进入编辑模式，根据实际情况修改超时参数的时间，单位为秒。
    1 2 3 4 5 6 self.collection.create_index( field_name = "vector", index_params = self.get_index_param(), index_name = "vector_index", timeout = 7200 )

  c. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
3. 可选：在第一次导入数据并创建索引之后，为了复用数据，可以将“milvus/module.py”中导入数据和创建索引的代码进行注释，此时，多次测试下召回率都保持一致。

  a. 打开文件。

```
/data/ann-benchmarks-main/ann_benchmarks/algorithms/milvus/module.py
```


  b. 按“i”进入编辑模式，注释如下代码。

```
if utility.has_collection(self.collection_name):
print(f"[Milvus] collection {self.collection_name} already exists, drop it...")
utility.drop_collection(self.collection_name)
```

```
self.insert(X)
self.create_index()
```

```
utility.drop_collection(self.collection_name)
```


4. 在本地使用milvus-hnsw算法搜索gist-960-euclidean数据集并立即获取所有查询，忽略已经存在的结果。

```
python run.py --algorithm milvus-hnsw --batch --threads 1 --local --force --dataset gist-960-euclidean
```


5. 本命令的查询结果将存储在.hdf5后缀文件中，请参考查看结果的命令格式和执行方法进行查看。
