mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
112 lines
3.5 KiB
Plaintext
112 lines
3.5 KiB
Plaintext
---
|
||
title: 安装插件开发工具
|
||
---
|
||
|
||
|
||
{/*
|
||
贡献者注意:
|
||
----------------
|
||
本文档为旧版文档,即将弃用。
|
||
请勿对此版本进行更改。
|
||
所有更新应指向新版本:
|
||
/plugin-dev-zh/0221-initialize-development-tools
|
||
*/}
|
||
|
||
<Card title="本文档即将弃用" icon="circle-exclamation" href="/plugin-dev-zh/0221-initialize-development-tools">
|
||
<p>作为我们文档重组的一部分,此页面正在逐步淘汰。</p>
|
||
|
||
<p><u><b>点击此卡片</b></u>跳转到包含最新信息的更新版本。</p>
|
||
|
||
<p>如果您在新的文档中发现任何差异或需要改进的地方,请使用页面底部的“报告问题”按钮。</p>
|
||
</Card>
|
||
|
||
在开始开发 Dify 插件之前,请准备以下先决条件:
|
||
|
||
* [Dify 插件 CLI 工具](https://github.com/langgenius/dify-plugin-daemon?tab=readme-ov-file#cli)
|
||
* [Python 3.12+](https://docs.python.org/3.12/using/index.html)
|
||
|
||
## **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
|
||
```
|
||
|
||
### 通过二进制可执行文件安装
|
||
|
||
**下载二进制可执行文件:**
|
||
|
||
在 [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. **开发插件**
|
||
|
||
请参考以下内容以获得不同类型插件开发的示例。
|
||
|
||
<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.
|
||
*/}
|
||
|
||
---
|
||
|
||
[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/plugins/quick-start/develop-plugins/initialize-development-tools.mdx) | [提交问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)
|
||
|