docs: 撰写pip文档

This commit is contained in:
dqy
2024-05-15 10:45:34 +08:00
parent 8d445b11a4
commit 958dee355e
2 changed files with 56 additions and 1 deletions

View File

@@ -66,6 +66,55 @@ python backdoor_detection.py ./src -o output/report.pdf -m regex
- 结果中会标注出每个文件中发现的高风险和中风险函数调用位置。
- 对于依赖检测,结果将标明每个依赖包的安全状态,包括存在安全风险的依赖及其版本。
## 打包
### 打包命令
```bash
pip install wheel
python setup.py sdist bdist_wheel
```
执行上述命令后,会在 dist 目录下生成 .tar.gz 和 .whl 文件。
### 本地安装
- 安装 .whl 文件:
``` bash
pip install dist/my_project-0.1.0-py3-none-any.whl
```
- 安装 .tar.gz 文件:
``` bash
pip install dist/my_project-0.1.0.tar.gz
```
### 上传到 PyPI
- 安装 twine
``` bash
pip install twine
```
- 使用 twine 上传包到 PyPI
``` bash
twine upload dist/*
```
需要提供 PyPI 的用户名和密码。如果没有 PyPI 账号,可以在 PyPI 注册。
### 使用 PyPI 安装
包上传到 PyPI 后,可以通过以下命令安装:
``` bash
pip install my_project
```
## 常见问题处理
- 确保所有路径都正确无误,避免因路径错误导致文件读取失败。