Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def ensure_PIL():
  2. try:
  3. import PIL
  4.  
  5. except ModuleNotFoundError:
  6. print("Installing PIL")
  7.  
  8. import subprocess
  9. r = subprocess.run(["pip", "install", "Pillow"])
  10.  
  11. if r.returncode == 0:
  12. import PIL
  13.  
  14. else:
  15. print("PIL could not be installed")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement