Files
dify-docs/zh-hans/plugins/quick-start/develop-plugins/initialize-development-tools.mdx
Bowen Liang 2720815e6b update chn
2025-05-07 05:34:25 +08:00

109 lines
3.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 安装插件开发工具
---
在开始开发 Dify 插件之前,请准备以下先决条件:
* [Dify 插件 CLI 工具](https://github.com/langgenius/dify-plugin-daemon?tab=readme-ov-file#cli)
* Python 3.12+
### **1. 安装 Dify 插件 CLI 工具**
Dify 插件 CLI 工具可以通过 Homebrew在 Linux 和 macOS 上)或独立的二进制可执行文件(在 Windows、Linux 和 macOS 上)进行安装。
#### 通过 Homebrew 安装
对于 macOS 和 Linux 用户,建议使用 [Homebrew](https://brew.sh/) 安装 Dify 插件 CLI。
首先添加 [Dify 插件 CLI 工具的 Homebrew 配方](https://github.com/langgenius/homebrew-dify),然后使用 `brew install` 命令进行安装。
```bash
brew tap langgenius/dify
brew install dify
```
要检查安装是否成功,请运行 `dify version`,应该会显示版本代码。
```bash
dify version
```
要升级 Dify 插件 CLI 工具,请运行以下命令:
```bash
brew upgrade dify
```
#### 通过二进制可执行文件安装
1. 下载二进制可执行文件
在 [Dify 插件 CLI 工具](https://github.com/langgenius/dify-plugin-daemon/releases) 的发布页面的资产列表中选择并下载适合操作系统Linux / macOS / Windows和芯片架构`amd64` 为 x86 芯片 / `arm64` 为 ARM 或 Apple 的 M 芯片)的二进制可执行文件。
以 **macOS M 芯片** 为例。下载 `dify-plugin-darwin-arm64` 文件,并通过以下命令授予其执行权限:
```bash
chmod +x ./dify-plugin-darwin-arm64
mv ./dify-plugin-darwin-arm64 ./dify
```
要检查安装是否成功,请运行 `./dify version`,应该会显示版本代码。
```bash
./dify version
```
> 如果系统显示“Apple 无法验证”的错误,请前往 **设置 → 隐私与安全 → 安全性**,点击“仍要打开”按钮。
<Info>
**提示:**
为了在系统范围内全局使用 `dify` 命令,建议将二进制文件重命名为 `dify` 并复制到 `/usr/local/bin` 系统路径中。
</Info>
### **2. 安装 Python**
需要 Python 版本 3.12 或更高版本。有关详细说明,请参考官方 [Python 安装](https://docs.python.org/3.12/using/index.html) 指南。
### 3. **开发插件**
请参考以下内容以获得不同类型插件开发的示例。
<Card title="tool-plugin" icon="link" href="tool-plugin">
工具插件
</Card>
<Card title="model-plugin" icon="link" href="model-plugin/">
模型插件
</Card>
<Card title="agent-strategy-plugin" icon="link" href="agent-strategy-plugin">
Agent策略插件
</Card>
<Card title="extension-plugin" icon="link" href="extension-plugin">
扩展插件
</Card>
<Card title="bundle" icon="link" href="bundle">
打包插件
</Card>
{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}
<CardGroup cols="2">
<Card
title="编辑此页面"
icon="pen-to-square"
href="https://github.com/langgenius/dify-docs-mintlify/edit/main/zh-hans/plugins/quick-start/develop-plugins/initialize-development-tools.mdx"
>
通过直接提交修改来帮助改进文档内容
</Card>
<Card
title="提交问题"
icon="github"
href="https://github.com/langgenius/dify-docs-mintlify/issues/new?title=文档问题%3A%20alize-development-to&body=%23%23%20问题描述%0A%3C%21--%20请简要描述您发现的问题%20--%3E%0A%0A%23%23%20页面链接%0Ahttps%3A%2F%2Fgithub.com%2Flanggenius%2Fdify-docs-mintlify%2Fblob%2Fmain%2Fzh-hans/plugins/quick-start/develop-plugins%2Finitialize-development-tools.mdx%0A%0A%23%23%20建议修改%0A%3C%21--%20如果有具体的修改建议请在此说明%20--%3E%0A%0A%3C%21--%20感谢您对文档质量的关注%20--%3E"
>
发现错误或有改进建议?请提交问题反馈
</Card>
</CardGroup>