guoyu/Test/python/Windows服务器安装命令.txt

71 lines
1.9 KiB
Plaintext
Raw Normal View History

2025-12-11 23:28:07 +08:00
# ============================================
# Whisper 服务器端安装命令清单 (Windows 版本)
# ============================================
# 一、配置 pip 使用清华镜像(加速下载)
# ============================================
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 二、安装 Python 依赖包
# ============================================
pip install flask==2.3.0 flask-cors==4.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
# 三、验证安装Windows 版本)
# ============================================
# 方式1使用 PowerShell 管道
pip list | Select-String -Pattern "flask|whisper|cors"
# 方式2使用 findstrCMD
pip list | findstr /i "flask whisper cors"
# 方式3直接查看全部简单
pip list
# 四、启动 Whisper 服务
# ============================================
# 方式1前台运行测试用
python whisper_server.py
# 方式2后台运行使用 start 命令)
start /b python whisper_server.py > whisper.log 2>&1
# 五、验证服务是否启动成功
# ============================================
# 使用 PowerShell 测试
curl http://localhost:5001/health
# 或使用浏览器访问
# http://localhost:5001/health
# 六、开放 Windows 防火墙端口
# ============================================
netsh advfirewall firewall add rule name="Whisper Service" dir=in action=allow protocol=TCP localport=5001
# 查看防火墙规则
netsh advfirewall firewall show rule name="Whisper Service"
# 七、查看服务运行状态
# ============================================
# 查看 Python 进程
tasklist | findstr python
# 查看端口占用
netstat -ano | findstr 5001
# 八、停止服务
# ============================================
# 方式1找到进程 ID 后停止
tasklist | findstr python
taskkill /PID 进程ID /F
# 方式2直接停止所有 python 进程(谨慎使用)
taskkill /IM python.exe /F