trading.ai/install_dependencies.sh
2025-08-14 10:06:19 +08:00

56 lines
1.7 KiB
Bash
Executable File
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.

#!/bin/bash
echo "正在安装加密货币选币引擎依赖..."
# 检查Python版本
python_version=$(python3 -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")
echo "Python版本: $python_version"
# 安装基础依赖
echo "安装基础Python包..."
pip3 install requests pandas numpy python-binance ccxt fastapi uvicorn jinja2 aiofiles schedule
# 安装TA-Lib
echo "安装TA-Lib..."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
echo "检测到macOS系统"
if command -v brew &> /dev/null; then
echo "使用Homebrew安装TA-Lib..."
brew install ta-lib
pip3 install TA-Lib
else
echo "请先安装Homebrew或手动安装TA-Lib"
echo "访问: https://github.com/mrjbq7/ta-lib#installation"
fi
elif [[ "$OSTYPE" == "linux"* ]]; then
# Linux
echo "检测到Linux系统"
# 尝试使用包管理器安装
if command -v apt-get &> /dev/null; then
sudo apt-get update
sudo apt-get install -y build-essential wget
# 下载并编译TA-Lib
cd /tmp
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr/local
make
sudo make install
cd ~
pip3 install TA-Lib
else
echo "请手动安装TA-Lib依赖"
fi
else
# Windows或其他系统
echo "其他系统请手动安装TA-Lib"
echo "Windows用户可以下载预编译包"
echo "https://github.com/cgohlke/talib-builds/releases"
fi
echo "依赖安装完成!"
echo "运行测试: python3 -c 'import talib; print(\"TA-Lib安装成功\")'"