ShopTRAINING/docs/portable_README.md

108 lines
2.5 KiB
Markdown
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.

# 药店销售预测系统 - 便携式环境使用说明
## 介绍 📋
这是一个基于Python 3.13嵌入式包的便携式环境可以在不安装Python的情况下运行药店销售预测系统。此环境完全独立不会影响系统中的其他Python安装。
## 系统要求 🖥️
- Windows 10/11 64位操作系统
- PowerShell 5.0或更高版本
- 互联网连接(用于初始下载)
- 至少500MB的磁盘空间
## 安装步骤 🔧
1. 确保PowerShell的执行策略允许运行脚本
以管理员身份打开PowerShell运行
```powershell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```
2. 运行环境设置脚本:
```powershell
.\setup_portable_env.ps1
```
此脚本将:
- 下载Python 3.13嵌入式包
- 设置基本环境
- 安装pip和所需依赖
- 创建便捷的启动脚本
3. 安装完成后,系统将显示使用说明。
## 使用方法 🚀
### 进入Python环境
```powershell
.\portable_python\activate.ps1
```
激活后,命令提示符前会显示一条消息,表明环境已激活。
### 运行药店销售预测系统
```powershell
.\portable_python\run_project.ps1
```
### 运行API服务
```powershell
.\portable_python\run_api.ps1
```
### 退出环境
在激活的环境中运行:
```powershell
deactivate
```
## GPU支持 🎮
默认安装的是PyTorch CPU版本。如需启用GPU支持请在环境激活后手动安装对应CUDA版本的PyTorch
```powershell
.\portable_python\activate.ps1
python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
```
注意您需要已安装兼容的NVIDIA显卡驱动和CUDA工具包。
## 常见问题 ❓
### Q: 为什么选择便携式环境?
A: 便携式环境避免了Python版本冲突、路径问题和依赖冲突特别是在含有中文路径的系统中。
### Q: 如何更新依赖?
A: 在激活环境后使用pip命令
```powershell
python -m pip install -r portable_requirements.txt --upgrade
```
### Q: 如何移动环境到其他计算机?
A: 只需复制整个项目文件夹包括portable_python目录即可。环境是完全自包含的。
## 故障排除 🔍
如果遇到"无法执行脚本"错误请确保已设置PowerShell执行策略
```powershell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```
如果安装依赖时出错,请尝试手动安装单个包:
```powershell
.\portable_python\activate.ps1
python -m pip install 包名称
```