The problem is that you are not running the same python interpreter. In addition, the problem could arise from this fact that python cannot find the path to the OpenCV.
You first need to find the path to the OpenCV installed on your OS.
First, open a python script and run this:
import cv2
PATH = cv2.__file__
print(PATH)
This will print the PATH to the OpenCV installed on your OS.
Then, add the following two lines to the top of your main script (before calling tkinter and PIL):
import sys
sys.path.append('PATH')
from tkinter import *
from PIL import ImageTk, Image
root.mainloop()
Alternative Solution:
The problem could be that you are not running the same python interpreter.
You first need to find the path to the python executable that is interpreting your python scripts.
Open a python script and run this:
import sys
PATH = sys.executable
print(PATH)
This will print the path to the python executable that is interpreting your python scripts.
Now, you can install pillow in the found path as follows:
PATH -m pip install pillow