-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
61 additions
and
55 deletions.
There are no files selected for viewing
Binary file modified
BIN
+1.72 KB
(200%)
func/__pycache__/instalar_bibliotecas_necessarias.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
import subprocess | ||
import sys | ||
|
||
cor_vermelha = "\033[1;31m" | ||
cor_verde = "\033[1;32m" | ||
cor_amarela = "\033[1;33m" | ||
cor_azul = "\033[1;34m" | ||
cor_roxa = "\033[1;35m" | ||
cor_ciano = "\033[1;36m" | ||
cor_branca = "\033[1;37m" | ||
cor_reset = "\033[0m" | ||
Cores = { | ||
"vermelha": "\033[1;31m", | ||
"verde": "\033[1;32m", | ||
"amarela": "\033[1;33m", | ||
"azul": "\033[1;34m", | ||
"roxa": "\033[1;35m", | ||
"ciano": "\033[1;36m", | ||
"branca": "\033[1;37m", | ||
"reset": "\033[0m", | ||
} | ||
|
||
def verificar_biblioteca(biblioteca): | ||
try: | ||
__import__(biblioteca) | ||
return True | ||
except ImportError: | ||
return False | ||
|
||
def instalar_biblioteca(biblioteca): | ||
print(f"{Cores['reset']}[{Cores['vermelha']}-{Cores['reset']}]{Cores['vermelha']} Instalando biblioteca {biblioteca}...{Cores['reset']}") | ||
try: | ||
subprocess.check_call([sys.executable, "-m", "pip", "install", biblioteca]) | ||
print(f"{Cores['reset']}[{Cores['azul']}+{Cores['reset']}]{Cores['verde']} {biblioteca} instalada com sucesso.{Cores['reset']}") | ||
except subprocess.CalledProcessError: | ||
print(f"{Cores['reset']}[{Cores['vermelha']}x{Cores['reset']}]{Cores['vermelha']} Erro ao instalar {biblioteca}. Verifique a saída do comando para mais detalhes.{Cores['reset']}") | ||
|
||
def instalar_bibliotecas_necessarias(): | ||
bibliotecas = [ | ||
"qdarkstyle", | ||
"colorama", | ||
"PyQt5", | ||
"matplotlib", | ||
"pyinstaller" | ||
"PyQt5" | ||
] | ||
|
||
print(f"\n{cor_amarela}Verificando bibliotecas...{cor_reset}") | ||
print(f"\n{Cores['amarela']}Verificando bibliotecas...{Cores['reset']}") | ||
|
||
for biblioteca in bibliotecas: | ||
print(f"{cor_reset}[{cor_amarela}*{cor_reset}]{cor_amarela} Verificando {biblioteca}{cor_reset}") | ||
try: | ||
__import__(biblioteca) | ||
print(f"{cor_reset}[{cor_azul}+{cor_reset}]{cor_verde} {biblioteca} Verificada {cor_reset}") | ||
except ImportError: | ||
print(f"{cor_reset}[{cor_vermelha}-{cor_reset}]{cor_vermelha} Instalando biblioteca {biblioteca}{cor_reset}") | ||
# Comando para instalar a biblioteca usando pip | ||
subprocess.check_call(["pip", "install", biblioteca]) | ||
print(f"{Cores['reset']}[{Cores['amarela']}*{Cores['reset']}]{Cores['amarela']} Verificando {biblioteca}{Cores['reset']}") | ||
if verificar_biblioteca(biblioteca): | ||
print(f"{Cores['reset']}[{Cores['azul']}+{Cores['reset']}]{Cores['verde']} {biblioteca} já está instalada.{Cores['reset']}") | ||
else: | ||
instalar_biblioteca(biblioteca) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.4 | ||
2.5 |