Upload install.py with huggingface_hub
Browse files- install.py +55 -0
install.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Script d'installation automatique pour le Bot de Concours Suisse
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import os
|
| 9 |
+
|
| 10 |
+
def run_command(command, description):
|
| 11 |
+
"""Exécute une commande et affiche le résultat"""
|
| 12 |
+
print(f"🔄 {description}...")
|
| 13 |
+
try:
|
| 14 |
+
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
|
| 15 |
+
print(f"✅ {description} - Succès")
|
| 16 |
+
return True
|
| 17 |
+
except subprocess.CalledProcessError as e:
|
| 18 |
+
print(f"❌ {description} - Erreur: {e}")
|
| 19 |
+
print(f"Output: {e.output}")
|
| 20 |
+
return False
|
| 21 |
+
|
| 22 |
+
def main():
|
| 23 |
+
print("🎰 INSTALLATION DU BOT DE CONCOURS SUISSE")
|
| 24 |
+
print("=" * 50)
|
| 25 |
+
|
| 26 |
+
# Vérifier Python
|
| 27 |
+
python_version = sys.version_info
|
| 28 |
+
if python_version.major < 3 or (python_version.major == 3 and python_version.minor < 8):
|
| 29 |
+
print("❌ Python 3.8+ requis. Version actuelle:", sys.version)
|
| 30 |
+
return False
|
| 31 |
+
|
| 32 |
+
print(f"✅ Python {python_version.major}.{python_version.minor} détecté")
|
| 33 |
+
|
| 34 |
+
# Installer les dépendances
|
| 35 |
+
if not run_command("pip install -r requirements.txt", "Installation des dépendances Python"):
|
| 36 |
+
return False
|
| 37 |
+
|
| 38 |
+
# Installer Playwright browsers
|
| 39 |
+
if not run_command("playwright install chromium", "Installation du navigateur Chromium"):
|
| 40 |
+
print("⚠️ Tentative d'installation alternative...")
|
| 41 |
+
if not run_command("python -m playwright install chromium", "Installation alternative de Chromium"):
|
| 42 |
+
return False
|
| 43 |
+
|
| 44 |
+
print("\n🎉 INSTALLATION TERMINÉE AVEC SUCCÈS!")
|
| 45 |
+
print("\n📖 PROCHAINES ÉTAPES:")
|
| 46 |
+
print("1. Modifiez vos informations personnelles dans bot_concours_sans_api.py")
|
| 47 |
+
print("2. Lancez le bot avec: python bot_concours_sans_api.py")
|
| 48 |
+
print("3. Ou lancez immédiatement avec: python bot_concours_sans_api.py --run-now")
|
| 49 |
+
|
| 50 |
+
return True
|
| 51 |
+
|
| 52 |
+
if __name__ == "__main__":
|
| 53 |
+
success = main()
|
| 54 |
+
if not success:
|
| 55 |
+
sys.exit(1)
|