1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
def installation_pillow():
"""
sudo python3 -m pip install pillow==3.4
debut python -m pip install pillow fin
Retourne True si l'instalation a été efféctuée avec succès
"""
rep = os.getcwd()
os.chdir(os.path.dirname(sys.executable)) #Le répertoire par défaut est celui de l'executable
if "win" in self.platform: #La syntaxe pour windows
pythons = ["py -"+self.version, "py -"+self.version.split(".")[0], "python"]
else: #La syntaxe de linux
pythons = ["python"+self.version, "python"+self.version.split(".")[0], "python"]
for fin in ["=="+self.version, "=="+self.version.split(".")[0], ""]:
for python in pythons:
if self.fin is True:
return False
message = python+" -m pip install pillow"+fin
print("-"*20+"\nExecution du message suivant:\n"+message+"\n")
if os.system(message) == 0:
os.chdir(rep)
return True
os.chdir(rep)
return False |
Partager