docs: update zh-tw (#265)

Reviewed-on: https://gitea.com/gitea/docs/pulls/265
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ifurther <55025025+ifurther@users.noreply.github.com>
Co-committed-by: ifurther <55025025+ifurther@users.noreply.github.com>
This commit is contained in:
ifurther
2025-09-03 21:00:35 +00:00
committed by techknowlogick
parent 908a27589d
commit cb462089e9
88 changed files with 3545 additions and 3423 deletions

View File

@@ -4,17 +4,17 @@ slug: "pypi"
sidebar_position: 100
---
# PyPI 软件包注册
# PyPI 軟體包註冊
您的用户或组织发布 [PyPI](https://pypi.org/) 软件包。
您的使用者或組織發佈 [PyPI](https://pypi.org/) 軟體包。
## 要求
要使用 PyPI 软件包注册表,您需要使用 [pip](https://pypi.org/project/pip/) 工具来消费和使用 [twine](https://pypi.org/project/twine/) 工具来发布软件包。
要使用 PyPI 軟體包註冊表,您需要使用 [pip](https://pypi.org/project/pip/) 工具来消费和使用 [twine](https://pypi.org/project/twine/) 工具来發佈軟體包。
## 配置软件包注册
## 配置軟體包註冊
要注册软件包注册表,您需要编辑本地的 `~/.pypirc` 文件。添加以下内容:
要注册軟體包註冊表,您需要编辑本地的 `~/.pypirc` 文件。添加以下内容:
```ini
[distutils]
@@ -28,36 +28,36 @@ password = {password}
| 占位符 | 描述 |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `owner` | 软件包的所有者 |
| `username` | 您的 Gitea 用户名 |
| `password` | 您的 Gitea 密。如果您使用 2FA 或 OAuth使用[个人访问令牌](development/api-usage.md#通-api-认证)替代密 |
| `owner` | 軟體包的所有者 |
| `username` | 您的 Gitea 使用者名 |
| `password` | 您的 Gitea 密。如果您使用 2FA 或 OAuth使用[个人访问令牌](development/api-usage.md#通-api-認證)替代密 |
## 发布软件
## 發佈軟體
运行以下命令来发布软件包:
运行以下命令来發佈軟體包:
```shell
python3 -m twine upload --repository gitea /path/to/files/*
```
软件包文件的扩展名 `.tar.gz``.whl`
軟體包文件的扩展名 `.tar.gz``.whl`
如果已存在具有相同名和版本的软件包,则无法发布软件包。您必先删除有的软件包。
如果已存在具有相同名和版本的軟體包,则無法發佈軟體包。您必先删除有的軟體包。
## 安装软件
## 安裝軟體
要从软件包注册表安 PyPI 软件包,请执行以下命令:
要从軟體包註冊表安 PyPI 軟體包,請執行以下命令:
```shell
pip install --index-url https://{username}:{password}@gitea.example.com/api/packages/{owner}/pypi/simple --no-deps {package_name}
```
| 参数 | 描述 |
| 參數 | 描述 |
| -------------- | ----------------------------- |
| `username` | 您的 Gitea 用户名 |
| `password` | 您的 Gitea 密或个人访问令牌 |
| `owner` | 软件包的所有者 |
| `package_name` | 软件包名 |
| `username` | 您的 Gitea 使用者名 |
| `password` | 您的 Gitea 密或个人访问令牌 |
| `owner` | 軟體包的所有者 |
| `package_name` | 軟體包名 |
例如:
@@ -65,7 +65,7 @@ pip install --index-url https://{username}:{password}@gitea.example.com/api/pack
pip install --index-url https://testuser:password123@gitea.example.com/api/packages/testuser/pypi/simple --no-deps test_package
```
您可以使用 `--extra-index-url` 替代 `--index-url`,但这样会使您容易受到依赖混淆攻,因 `pip` 会先检查官方 PyPi 仓库中的软件包,然后再检查指定的自定义仓库。请阅读 `pip`以获取更多信息。
您可以使用 `--extra-index-url` 替代 `--index-url`,但这样会使您容易受到依赖混淆攻,因 `pip` 会先检查官方 PyPi 存放庫中的軟體包,然后再检查指定的自定义存放庫。請阅读 `pip`以获取更多信息。
## 支持的命令