windowns下安装conda可以参考这篇文章:【安装conda】

1.创建graphrag安装环境

使用以下命令创建graphrag环境,这里,我们还指定了安装graphrag环境存储目录。注意,环境名称不能重复。

conda create --prefix D:\Work\AI\graphrag_conda_env

其中:
--prefix D:\Work\AI\graphrag_conda_env 指定了环境的安装目录。

注意,创建conda环境时,--name、--prefix不能同时使用。--name是把指定的环境名在conda默认目录进创建,--prefix则是使用指定的目录。

回车后开始执行环境创建,创建过程出现提示时输入y再回车:

3 channel Terms of Service accepted
Retrieving notices: done
Channels:
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: D:\Work\AI\graphrag_conda_env



Proceed ([y]/n)? y

继续完成后续环境的创建,创建过程的信息如下:

C:\Users\Administrator>conda create --prefix D:\Work\AI\graphrag_conda_env
3 channel Terms of Service accepted
Retrieving notices: done
Channels:
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: D:\Work\AI\graphrag_conda_env



Proceed ([y]/n)? y


Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate D:\Work\AI\graphrag_conda_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate


C:\Users\Administrator>

2.激活graphrag安装环境

执行第一步的提示命令(如下所示)来激活graphrag安装环境。

conda activate D:\Work\AI\graphrag_conda_env

激活后,命令行效果如下:

C:\Users\Administrator>conda activate D:\Work\AI\graphrag_conda_env

(D:\Work\AI\graphrag_conda_env) C:\Users\Administrator>

3.下载graphrag源码

使用以下命令下载源码到D:\Work\AI\目录下

cd D:\Work\AI\
git clone https://github.com/microsoft/graphrag.git

4.基于源码安装graphrag

执行以下命令基于源码安装graphrag

cd D:\Work\AI\graphrag
pip install -e ".[default]"

看到以下信息表示安装成功:

Building wheels for collected packages: graphrag
  Building editable for graphrag (pyproject.toml) ... done
  Created wheel for graphrag: filename=graphrag-2.7.0-0.editable-py3-none-any.whl size=6421 sha256=5a67d99c56f15cf501604a295a68463748b04f707de4c0ba0f99aa98c897f801
  Stored in directory: C:\Users\Administrator\AppData\Local\Temp\pip-ephem-wheel-cache-12i4rpxs\wheels\9a\0f\19\8061494895f503bc97ce936c7a80b531a05b8e085a9ae6ecdb
Successfully built graphrag
Installing collected packages: graphrag
  Attempting uninstall: graphrag
    Found existing installation: graphrag 2.7.0
    Uninstalling graphrag-2.7.0:
      Successfully uninstalled graphrag-2.7.0
Successfully installed graphrag-2.7.0

(D:\Work\AI\graphrag_conda_env) D:\Work\AI\graphrag>

输入以下命令可以进一步验证安装是否成功:

(D:\Work\AI\graphrag_conda_env) D:\Work\AI\graphrag>graphrag

安装成功时将返回以下信息:

 Usage: graphrag [OPTIONS] COMMAND [ARGS]...

 GraphRAG: A graph-based retrieval-augmented generation (RAG) system.

┌─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ --install-completion          Install completion for the current shell.                                                                                                                                                                                  │
│ --show-completion             Show completion for the current shell, to copy it or customize the installation.                                                                                                                                           │
│ --help                        Show this message and exit.                                                                                                                                                                                                │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ init          Generate a default configuration file.                                                                                                                                                                                                     │
│ index         Build a knowledge graph index.                                                                                                                                                                                                             │
│ update        Update an existing knowledge graph index.                                                                                                                                                                                                  │
│ prompt-tune   Generate custom graphrag prompts with your own data (i.e. auto templating).                                                                                                                                                                │
│ query         Query a knowledge graph index.                                                                                                                                                                                                             │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

(D:\Work\AI\graphrag_conda_env) D:\Work\AI\graphrag>

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐