'How to find out whether the python path for Blender is correct?

I now successfully installed PIL on python3.

In pycharm i can use

import PIL

and no error comes up.

But...

I also want to use PIL in Blender.

But here

import PIL

results in the error:

Traceback (most recent call last):
  File "/Users/chris/Downloads/python_extend_images_jpg_png_alpha_black.blend/Text", line 3, in <module>
ModuleNotFoundError: No module named 'PIL'
Error: Python script failed, check the message in the system console

i assume that Blender uses another python3 version.

If i run this in the python console of Blender:

>>> import sys
>>> 
>>> print(sys.version)
3.10.2 (main, Jan 26 2022, 15:26:42) [Clang 13.0.0 (clang-1300.0.29.30)]

>>> print(sys.executable)
/Applications/Blender.app/Contents/Resources/3.2/python/bin/python3.10

running this in my shell:

chris@MBPvonChristoph ~ % which python                 
/usr/bin/python
chris@MBPvonChristoph ~ % which python3
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3
chris@MBPvonChristoph ~ % 

Is this ok? Shouldn't the path in Blender point to

/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 ? 

If yes, how can i change that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source