setup_tsinghua.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. echo "==================================="
  3. echo "使用清华大学镜像安装依赖"
  4. echo "Installing dependencies using Tsinghua mirror"
  5. echo "==================================="
  6. echo
  7. # Check if Python is installed
  8. if ! command -v python3 &> /dev/null && ! command -v python &> /dev/null; then
  9. echo "Error: Python is not installed!"
  10. echo "错误:未安装Python!"
  11. echo "Please install Python from https://www.python.org/"
  12. exit 1
  13. fi
  14. # Use python3 if available, otherwise fall back to python
  15. if command -v python3 &> /dev/null; then
  16. PYTHON_CMD=python3
  17. else
  18. PYTHON_CMD=python
  19. fi
  20. echo "Installing from Tsinghua University mirror..."
  21. echo "正在从清华大学镜像源安装..."
  22. echo
  23. # Install using Tsinghua mirror
  24. $PYTHON_CMD -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
  25. if [ $? -eq 0 ]; then
  26. echo
  27. echo "✓ Installation completed successfully!"
  28. echo "✓ 安装成功完成!"
  29. echo
  30. echo "You can now run the application using: ./run_app.sh"
  31. echo "现在可以使用 ./run_app.sh 运行应用程序"
  32. else
  33. echo
  34. echo "Installation failed!"
  35. echo "安装失败!"
  36. exit 1
  37. fi