0

Basically it's saying pil doesnt exist. I Googled that, it tells me to install pillow. I tried with pip, with conda, different variations of commands, and nothing worked. Specifically there's a syntax error on install in pip install Pillow.

import PIL
import tkinter as tk

root = tk.Tk()
root.geometry("1920x1080")
play = True
cor1 = PIL.Image.open(r"src\obj\1.jpg")
cor2 = PIL.Image.open(r"src\obj\2.jpg")
cor3 = PIL.Image.open(r"src\obj\3.jpg")
menuop = PIL.Image.open(r"src\obj\menuop.jpg")

def menu():
    global play
    play = False
    menuop.show()
    userchoice = Tkinter.Button()
    button.place(x=1171, y=453, in_=root)
while play == True:
    menu()

Tried: Installing pillow through code, cmd, got a syntax error.
Also tried import image instead, got same error.
Also tried conda install instead of pip install.
Also tried a bunch of variations of the command like --install, ipython, !pip, etc.

In short, can't install pillow, pil doesn't exist, image doesn't exist, can't use pip or conda.

@martineau in the comments linked me a site to download pillow manually, I also tried that. I got the error unable to create process.

List of errors:

pil does not exist

pip **install** syntax error

C:\Users\Asa\AppData\Local\Programs\Python\Python38-32\Scripts>python -m pip install Pillow
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

Fatal error in launcher: Unable to create process using '"c:\users\divit\appdata\local\programs\python\python38-32\python.exe"  "C:\Users\Asa\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe" install Pillow'
martineau
  • 119,623
  • 25
  • 170
  • 301
  • 2
    `pip` and `conda` are meant to be run from a command line, not from inside Python. On Windows, that's CMD. On Linux, that's probably bash. – Silvio Mayolo Apr 01 '22 at 20:41
  • You can download and install a pre-built version of it from [Christoph Gohlke's website](https://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow). I've done so for years. Note you will need to use `pip` to install the wheel file. – martineau Apr 01 '22 at 20:44
  • 1
    yes silvo, as I said I tried with cmd. – Lagging Potato Apr 01 '22 at 20:44
  • Can you post all the errors message of the errors you are describing ? – Bao Huynh Lam Apr 01 '22 at 21:06
  • To use the Pillow version of PIL, you will need to write `from PIL import Image`. – martineau Apr 01 '22 at 22:12
  • Also see [How do I install a Python package with a .whl file?](https://stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file/27909082#27909082) – martineau Apr 01 '22 at 22:14

2 Answers2

0

Pip install in your local python folder. Then in the same folder pip install Pillow,tkinter,etc. Dont name your files to something like: "tkinter", "pillow",etc

Reactord
  • 96
  • 1
  • 11
0

wow, I feel dumb now. I navigated with cd.. every time and typing in pip install manually, but I was supposed to just put the code into a batch file and run that instead. Kind of sad that I didnt see any mention of this after googling for over an hour and a half

  • There is a better way to manage your dependencies for python. The simple way is to use `requirements.txt`. There are others, arguably better way, such as `Pipenv` and the likes. Just google those keywords. – Thu Ya Kyaw Apr 02 '22 at 03:10
  • 1
    This is not an answer, should have been a comment. – Tony BenBrahim Apr 02 '22 at 03:13