Files
dify-docs/plugin_dev_zh/0221-initialize-development-tools.zh.mdx
2025-05-04 01:17:47 +08:00

90 lines
4.0 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.
---
dimensions:
type:
primary: implementation
detail: standard
level: beginner
standard_title: Initialize Development Tools
language: zh
title: 初始化开发工具
description: 本文档详细介绍了Dify插件开发前的必要准备工作包括安装Dify插件脚手架工具dify-plugin-daemon和配置Python环境版本要求≥3.12)的完整步骤。文档还提供了各类型插件开发的参考链接。
---
开发 Dify 插件需要进行以下准备。本文档是开始[插件开发](/plugin_dev_zh/0111-getting-started-dify-plugin.zh)的第一步。
* Dify 插件脚手架工具
* Python 环境,版本号 ≥ 3.12
> Dify 插件开发脚手架工具又称为 `dify-plugin-daemon`,可以被视作**插件开发 SDK**。
### **1. 安装 Dify 插件开发脚手架工具**
访问 [Dify Plugin CLI](https://github.com/langgenius/dify-plugin-daemon/releases) 项目地址,下载并安装最新版本号和对应操作系统的工具。
本文**以装载 M 系列芯片的 macOS** 为例。下载 `dify-plugin-darwin-arm64` 文件后,赋予其执行权限。
```
chmod +x dify-plugin-darwin-arm64
```
运行以下命令检查安装是否成功。
```
./dify-plugin-darwin-arm64 version
```
> 若提示 “Apple 无法验证” 错误,请前往 **“设置 → 隐私与安全性 → 安全性”**,轻点 “仍要打开” 按钮。
运行命令后,终端若返回类似 `v0.0.1-beta.15` 的版本号信息,则说明安装成功。
> **💡 提示:**
>
> 如果想要在系统全局使用 `dify` 命令运行脚手架工具,建议将该二进制文件重命名为 `dify` 并拷贝至 `/usr/local/bin` 系统路径内。
>
> 配置完成后,在终端输入 `dify version` 命令后将输出版本号信息。
>
> <img src="https://assets-docs.dify.ai/2025/02/74e57a57c1ae1cc70f4a45084cbbb37e.png" alt="" />
### **2. 初始化 Python 环境**
详细说明请参考 [Python 安装教程](https://pythontest.com/python/installing-python-3-11/),或询问 LLM 安装版本号 ≥ 3.12 的 Python 环境。
### 3. 开发插件
请参考以下内容查看不同类型的插件开发示例:
- [工具插件开发指南](/plugin_dev_zh/0211-getting-started-dify-tool.zh) - Hello World 入门教程
- [模型插件开发指南](/plugin_dev_zh/0211-getting-started-new-model.zh) - 快速接入一个新模型
- [Agent策略插件开发指南](/plugin_dev_zh/9433-agent-strategy-plugin.zh) - 创建自定义推理策略
- [扩展插件开发指南](/plugin_dev_zh/9231-extension-plugin.zh) - 通过 Webhook 实现外部服务集成
- [插件打包和发布](/plugin_dev_zh/0321-release-overview.zh) - 发布您的插件
## 下一步学习
- [Dify 插件开发Hello World 指南](/plugin_dev_zh/0211-getting-started-dify-tool.zh) - 开始您的第一个插件开发
- [插件开发速查表](/plugin_dev_zh/0131-cheatsheet.zh) - 了解常用命令和概念
- [一般规范定义](/plugin_dev_zh/0411-general-specifications.zh) - 学习插件元数据配置
{/*
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/plugin_dev_zh/0221-initialize-development-tools.zh.mdx"
>
通过直接提交修改来帮助改进文档内容
</Card>
<Card
title="提交问题"
icon="github"
href="https://github.com/langgenius/dify-docs-mintlify/issues/new?title=文档问题%3A%20initialize-development-tools&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%2Fplugin_dev_zh%2F0221-initialize-development-tools.zh.mdx%0A%0A%23%23%20建议修改%0A%3C%21--%20如果有具体的修改建议请在此说明%20--%3E%0A%0A%3C%21--%20感谢您对文档质量的关注%20--%3E"
>
发现错误或有改进建议?请提交问题反馈
</Card>
</CardGroup>